1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.Widget; 26 27 private import cairo.FontOption; 28 private import gdk.Clipboard; 29 private import gdk.Cursor; 30 private import gdk.Display; 31 private import gdk.FrameClock; 32 private import gio.ActionGroupIF; 33 private import gio.ListModelIF; 34 private import glib.ListG; 35 private import glib.MemorySlice; 36 private import glib.Str; 37 private import glib.Variant; 38 private import glib.c.functions; 39 private import gobject.ObjectG; 40 private import gobject.Signals; 41 private import graphene.Matrix; 42 private import graphene.Point; 43 private import graphene.Rect; 44 private import gsk.Transform; 45 private import gtk.AccessibleIF; 46 private import gtk.AccessibleT; 47 private import gtk.BuildableIF; 48 private import gtk.BuildableT; 49 private import gtk.ConstraintTargetIF; 50 private import gtk.ConstraintTargetT; 51 private import gtk.EventController; 52 private import gtk.LayoutManager; 53 private import gtk.NativeIF; 54 private import gtk.Requisition; 55 private import gtk.RootIF; 56 private import gtk.Settings; 57 private import gtk.Snapshot; 58 private import gtk.StyleContext; 59 private import gtk.Tooltip; 60 private import gtk.c.functions; 61 public import gtk.c.types; 62 private import pango.PgContext; 63 private import pango.PgFontMap; 64 private import pango.PgLayout; 65 private import std.algorithm; 66 67 68 /** 69 * The base class for all widgets. 70 * 71 * `GtkWidget` is the base class all widgets in GTK derive from. It manages the 72 * widget lifecycle, layout, states and style. 73 * 74 * ### Height-for-width Geometry Management 75 * 76 * GTK uses a height-for-width (and width-for-height) geometry management 77 * system. Height-for-width means that a widget can change how much 78 * vertical space it needs, depending on the amount of horizontal space 79 * that it is given (and similar for width-for-height). The most common 80 * example is a label that reflows to fill up the available width, wraps 81 * to fewer lines, and therefore needs less height. 82 * 83 * Height-for-width geometry management is implemented in GTK by way 84 * of two virtual methods: 85 * 86 * - [vfunc@Gtk.Widget.get_request_mode] 87 * - [vfunc@Gtk.Widget.measure] 88 * 89 * There are some important things to keep in mind when implementing 90 * height-for-width and when using it in widget implementations. 91 * 92 * If you implement a direct `GtkWidget` subclass that supports 93 * height-for-width or width-for-height geometry management for itself 94 * or its child widgets, the [vfunc@Gtk.Widget.get_request_mode] virtual 95 * function must be implemented as well and return the widget's preferred 96 * request mode. The default implementation of this virtual function 97 * returns %GTK_SIZE_REQUEST_CONSTANT_SIZE, which means that the widget will 98 * only ever get -1 passed as the for_size value to its 99 * [vfunc@Gtk.Widget.measure] implementation. 100 * 101 * The geometry management system will query a widget hierarchy in 102 * only one orientation at a time. When widgets are initially queried 103 * for their minimum sizes it is generally done in two initial passes 104 * in the [enum@Gtk.SizeRequestMode] chosen by the toplevel. 105 * 106 * For example, when queried in the normal %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH mode: 107 * 108 * First, the default minimum and natural width for each widget 109 * in the interface will be computed using [id@gtk_widget_measure] with an 110 * orientation of %GTK_ORIENTATION_HORIZONTAL and a for_size of -1. 111 * Because the preferred widths for each widget depend on the preferred 112 * widths of their children, this information propagates up the hierarchy, 113 * and finally a minimum and natural width is determined for the entire 114 * toplevel. Next, the toplevel will use the minimum width to query for the 115 * minimum height contextual to that width using [id@gtk_widget_measure] with an 116 * orientation of %GTK_ORIENTATION_VERTICAL and a for_size of the just computed 117 * width. This will also be a highly recursive operation. The minimum height 118 * for the minimum width is normally used to set the minimum size constraint 119 * on the toplevel. 120 * 121 * After the toplevel window has initially requested its size in both 122 * dimensions it can go on to allocate itself a reasonable size (or a size 123 * previously specified with [method@Gtk.Window.set_default_size]). During the 124 * recursive allocation process it’s important to note that request cycles 125 * will be recursively executed while widgets allocate their children. 126 * Each widget, once allocated a size, will go on to first share the 127 * space in one orientation among its children and then request each child's 128 * height for its target allocated width or its width for allocated height, 129 * depending. In this way a `GtkWidget` will typically be requested its size 130 * a number of times before actually being allocated a size. The size a 131 * widget is finally allocated can of course differ from the size it has 132 * requested. For this reason, `GtkWidget` caches a small number of results 133 * to avoid re-querying for the same sizes in one allocation cycle. 134 * 135 * If a widget does move content around to intelligently use up the 136 * allocated size then it must support the request in both 137 * `GtkSizeRequestMode`s even if the widget in question only 138 * trades sizes in a single orientation. 139 * 140 * For instance, a [class@Gtk.Label] that does height-for-width word wrapping 141 * will not expect to have [vfunc@Gtk.Widget.measure] with an orientation of 142 * %GTK_ORIENTATION_VERTICAL called because that call is specific to a 143 * width-for-height request. In this case the label must return the height 144 * required for its own minimum possible width. By following this rule any 145 * widget that handles height-for-width or width-for-height requests will 146 * always be allocated at least enough space to fit its own content. 147 * 148 * Here are some examples of how a %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH widget 149 * generally deals with width-for-height requests: 150 * 151 * ```c 152 * static void 153 * foo_widget_measure (GtkWidget *widget, 154 * GtkOrientation orientation, 155 * int for_size, 156 * int *minimum_size, 157 * int *natural_size, 158 * int *minimum_baseline, 159 * int *natural_baseline) 160 * { 161 * if (orientation == GTK_ORIENTATION_HORIZONTAL) 162 * { 163 * // Calculate minimum and natural width 164 * } 165 * else // VERTICAL 166 * { 167 * if (i_am_in_height_for_width_mode) 168 * { 169 * int min_width, dummy; 170 * 171 * // First, get the minimum width of our widget 172 * GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_HORIZONTAL, -1, 173 * &min_width, &dummy, &dummy, &dummy); 174 * 175 * // Now use the minimum width to retrieve the minimum and natural height to display 176 * // that width. 177 * GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_VERTICAL, min_width, 178 * minimum_size, natural_size, &dummy, &dummy); 179 * } 180 * else 181 * { 182 * // ... some widgets do both. 183 * } 184 * } 185 * } 186 * ``` 187 * 188 * Often a widget needs to get its own request during size request or 189 * allocation. For example, when computing height it may need to also 190 * compute width. Or when deciding how to use an allocation, the widget 191 * may need to know its natural size. In these cases, the widget should 192 * be careful to call its virtual methods directly, like in the code 193 * example above. 194 * 195 * It will not work to use the wrapper function [method@Gtk.Widget.measure] 196 * inside your own [vfunc@Gtk.Widget.size_allocate] implementation. 197 * These return a request adjusted by [class@Gtk.SizeGroup], the widget's 198 * align and expand flags, as well as its CSS style. 199 * 200 * If a widget used the wrappers inside its virtual method implementations, 201 * then the adjustments (such as widget margins) would be applied 202 * twice. GTK therefore does not allow this and will warn if you try 203 * to do it. 204 * 205 * Of course if you are getting the size request for another widget, such 206 * as a child widget, you must use [id@gtk_widget_measure]; otherwise, you 207 * would not properly consider widget margins, [class@Gtk.SizeGroup], and 208 * so forth. 209 * 210 * GTK also supports baseline vertical alignment of widgets. This 211 * means that widgets are positioned such that the typographical baseline of 212 * widgets in the same row are aligned. This happens if a widget supports 213 * baselines, has a vertical alignment of %GTK_ALIGN_BASELINE, and is inside 214 * a widget that supports baselines and has a natural “row” that it aligns to 215 * the baseline, or a baseline assigned to it by the grandparent. 216 * 217 * Baseline alignment support for a widget is also done by the 218 * [vfunc@Gtk.Widget.measure] virtual function. It allows you to report 219 * both a minimum and natural size. 220 * 221 * If a widget ends up baseline aligned it will be allocated all the space in 222 * the parent as if it was %GTK_ALIGN_FILL, but the selected baseline can be 223 * found via [id@gtk_widget_get_allocated_baseline]. If the baseline has a 224 * value other than -1 you need to align the widget such that the baseline 225 * appears at the position. 226 * 227 * ### GtkWidget as GtkBuildable 228 * 229 * The `GtkWidget` implementation of the `GtkBuildable` interface 230 * supports various custom elements to specify additional aspects of widgets 231 * that are not directly expressed as properties. 232 * 233 * If the widget uses a [class@Gtk.LayoutManager], `GtkWidget` supports 234 * a custom `<layout>` element, used to define layout properties: 235 * 236 * ```xml 237 * <object class="GtkGrid" id="my_grid"> 238 * <child> 239 * <object class="GtkLabel" id="label1"> 240 * <property name="label">Description</property> 241 * <layout> 242 * <property name="column">0</property> 243 * <property name="row">0</property> 244 * <property name="row-span">1</property> 245 * <property name="column-span">1</property> 246 * </layout> 247 * </object> 248 * </child> 249 * <child> 250 * <object class="GtkEntry" id="description_entry"> 251 * <layout> 252 * <property name="column">1</property> 253 * <property name="row">0</property> 254 * <property name="row-span">1</property> 255 * <property name="column-span">1</property> 256 * </layout> 257 * </object> 258 * </child> 259 * </object> 260 * ``` 261 * 262 * `GtkWidget` allows style information such as style classes to 263 * be associated with widgets, using the custom `<style>` element: 264 * 265 * ```xml 266 * <object class="GtkButton" id="button1"> 267 * <style> 268 * <class name="my-special-button-class"/> 269 * <class name="dark-button"/> 270 * </style> 271 * </object> 272 * ``` 273 * 274 * `GtkWidget` allows defining accessibility information, such as properties, 275 * relations, and states, using the custom `<accessibility>` element: 276 * 277 * ```xml 278 * <object class="GtkButton" id="button1"> 279 * <accessibility> 280 * <property name="label">Download</property> 281 * <relation name="labelled-by">label1</relation> 282 * </accessibility> 283 * </object> 284 * ``` 285 * 286 * ### Building composite widgets from template XML 287 * 288 * `GtkWidget `exposes some facilities to automate the procedure 289 * of creating composite widgets using "templates". 290 * 291 * To create composite widgets with `GtkBuilder` XML, one must associate 292 * the interface description with the widget class at class initialization 293 * time using [method@Gtk.WidgetClass.set_template]. 294 * 295 * The interface description semantics expected in composite template descriptions 296 * is slightly different from regular [class@Gtk.Builder] XML. 297 * 298 * Unlike regular interface descriptions, [method@Gtk.WidgetClass.set_template] will 299 * expect a `<template>` tag as a direct child of the toplevel `<interface>` 300 * tag. The `<template>` tag must specify the “class” attribute which must be 301 * the type name of the widget. Optionally, the “parent” attribute may be 302 * specified to specify the direct parent type of the widget type, this is 303 * ignored by `GtkBuilder` but required for UI design tools like 304 * [Glade](https://glade.gnome.org/) to introspect what kind of properties and 305 * internal children exist for a given type when the actual type does not exist. 306 * 307 * The XML which is contained inside the `<template>` tag behaves as if it were 308 * added to the `<object>` tag defining the widget itself. You may set properties 309 * on a widget by inserting `<property>` tags into the `<template>` tag, and also 310 * add `<child>` tags to add children and extend a widget in the normal way you 311 * would with `<object>` tags. 312 * 313 * Additionally, `<object>` tags can also be added before and after the initial 314 * `<template>` tag in the normal way, allowing one to define auxiliary objects 315 * which might be referenced by other widgets declared as children of the 316 * `<template>` tag. 317 * 318 * An example of a template definition: 319 * 320 * ```xml 321 * <interface> 322 * <template class="FooWidget" parent="GtkBox"> 323 * <property name="orientation">horizontal</property> 324 * <property name="spacing">4</property> 325 * <child> 326 * <object class="GtkButton" id="hello_button"> 327 * <property name="label">Hello World</property> 328 * <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/> 329 * </object> 330 * </child> 331 * <child> 332 * <object class="GtkButton" id="goodbye_button"> 333 * <property name="label">Goodbye World</property> 334 * </object> 335 * </child> 336 * </template> 337 * </interface> 338 * ``` 339 * 340 * Typically, you'll place the template fragment into a file that is 341 * bundled with your project, using `GResource`. In order to load the 342 * template, you need to call [method@Gtk.WidgetClass.set_template_from_resource] 343 * from the class initialization of your `GtkWidget` type: 344 * 345 * ```c 346 * static void 347 * foo_widget_class_init (FooWidgetClass *klass) 348 * { 349 * // ... 350 * 351 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 352 * "/com/example/ui/foowidget.ui"); 353 * } 354 * ``` 355 * 356 * You will also need to call [method@Gtk.Widget.init_template] from the 357 * instance initialization function: 358 * 359 * ```c 360 * static void 361 * foo_widget_init (FooWidget *self) 362 * { 363 * // ... 364 * gtk_widget_init_template (GTK_WIDGET (self)); 365 * } 366 * ``` 367 * 368 * You can access widgets defined in the template using the 369 * [id@gtk_widget_get_template_child] function, but you will typically declare 370 * a pointer in the instance private data structure of your type using the same 371 * name as the widget in the template definition, and call 372 * [method@Gtk.WidgetClass.bind_template_child_full] (or one of its wrapper macros 373 * [func@Gtk.widget_class_bind_template_child] and [func@Gtk.widget_class_bind_template_child_private]) 374 * with that name, e.g. 375 * 376 * ```c 377 * typedef struct { 378 * GtkWidget *hello_button; 379 * GtkWidget *goodbye_button; 380 * } FooWidgetPrivate; 381 * 382 * G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX) 383 * 384 * static void 385 * foo_widget_class_init (FooWidgetClass *klass) 386 * { 387 * // ... 388 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 389 * "/com/example/ui/foowidget.ui"); 390 * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), 391 * FooWidget, hello_button); 392 * gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), 393 * FooWidget, goodbye_button); 394 * } 395 * 396 * static void 397 * foo_widget_init (FooWidget *widget) 398 * { 399 * 400 * } 401 * ``` 402 * 403 * You can also use [method@Gtk.WidgetClass.bind_template_callback_full] (or 404 * is wrapper macro [func@Gtk.widget_class_bind_template_callback]) to connect 405 * a signal callback defined in the template with a function visible in the 406 * scope of the class, e.g. 407 * 408 * ```c 409 * // the signal handler has the instance and user data swapped 410 * // because of the swapped="yes" attribute in the template XML 411 * static void 412 * hello_button_clicked (FooWidget *self, 413 * GtkButton *button) 414 * { 415 * g_print ("Hello, world!\n"); 416 * } 417 * 418 * static void 419 * foo_widget_class_init (FooWidgetClass *klass) 420 * { 421 * // ... 422 * gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 423 * "/com/example/ui/foowidget.ui"); 424 * gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked); 425 * } 426 * ``` 427 */ 428 public class Widget : ObjectG, AccessibleIF, BuildableIF, ConstraintTargetIF 429 { 430 /** the main Gtk struct */ 431 protected GtkWidget* gtkWidget; 432 433 /** Get the main Gtk struct */ 434 public GtkWidget* getWidgetStruct(bool transferOwnership = false) 435 { 436 if (transferOwnership) 437 ownedRef = false; 438 return gtkWidget; 439 } 440 441 /** the main Gtk struct as a void* */ 442 protected override void* getStruct() 443 { 444 return cast(void*)gtkWidget; 445 } 446 447 /** 448 * Sets our main struct and passes it to the parent class. 449 */ 450 public this (GtkWidget* gtkWidget, bool ownedRef = false) 451 { 452 this.gtkWidget = gtkWidget; 453 super(cast(GObject*)gtkWidget, ownedRef); 454 } 455 456 // add the Accessible capabilities 457 mixin AccessibleT!(GtkWidget); 458 459 // add the Buildable capabilities 460 mixin BuildableT!(GtkWidget); 461 462 // add the ConstraintTarget capabilities 463 mixin ConstraintTargetT!(GtkWidget); 464 465 466 /** */ 467 public static GType getType() 468 { 469 return gtk_widget_get_type(); 470 } 471 472 /** 473 * Obtains the current default reading direction. 474 * 475 * See [func@Gtk.Widget.set_default_direction]. 476 * 477 * Returns: the current default direction. 478 */ 479 public static GtkTextDirection getDefaultDirection() 480 { 481 return gtk_widget_get_default_direction(); 482 } 483 484 /** 485 * Sets the default reading direction for widgets. 486 * 487 * See [method@Gtk.Widget.set_direction]. 488 * 489 * Params: 490 * dir = the new default direction. This cannot be %GTK_TEXT_DIR_NONE. 491 */ 492 public static void setDefaultDirection(GtkTextDirection dir) 493 { 494 gtk_widget_set_default_direction(dir); 495 } 496 497 /** 498 * Enable or disable an action installed with 499 * gtk_widget_class_install_action(). 500 * 501 * Params: 502 * actionName = action name, such as "clipboard.paste" 503 * enabled = whether the action is now enabled 504 */ 505 public void actionSetEnabled(string actionName, bool enabled) 506 { 507 gtk_widget_action_set_enabled(gtkWidget, Str.toStringz(actionName), enabled); 508 } 509 510 /** 511 * For widgets that can be “activated” (buttons, menu items, etc.), 512 * this function activates them. 513 * 514 * The activation will emit the signal set using 515 * [method@Gtk.WidgetClass.set_activate_signal] during class initialization. 516 * 517 * Activation is what happens when you press <kbd>Enter</kbd> 518 * on a widget during key navigation. 519 * 520 * If you wish to handle the activation keybinding yourself, it is 521 * recommended to use [method@Gtk.WidgetClass.add_shortcut] with an action 522 * created with [ctor@Gtk.SignalAction.new]. 523 * 524 * If @widget isn't activatable, the function returns %FALSE. 525 * 526 * Returns: %TRUE if the widget was activatable 527 */ 528 public bool activate() 529 { 530 return gtk_widget_activate(gtkWidget) != 0; 531 } 532 533 /** 534 * Looks up the action in the action groups associated with 535 * @widget and its ancestors, and activates it. 536 * 537 * If the action is in an action group added with 538 * [method@Gtk.Widget.insert_action_group], the @name is expected 539 * to be prefixed with the prefix that was used when the group was 540 * inserted. 541 * 542 * The arguments must match the actions expected parameter type, 543 * as returned by `g_action_get_parameter_type()`. 544 * 545 * Params: 546 * name = the name of the action to activate 547 * args = parameters to use 548 * 549 * Returns: %TRUE if the action was activated, %FALSE if the 550 * action does not exist. 551 */ 552 public bool activateActionVariant(string name, Variant args) 553 { 554 return gtk_widget_activate_action_variant(gtkWidget, Str.toStringz(name), (args is null) ? null : args.getVariantStruct()) != 0; 555 } 556 557 /** 558 * Activates the `default.activate` action from @widget. 559 */ 560 public void activateDefault() 561 { 562 gtk_widget_activate_default(gtkWidget); 563 } 564 565 /** 566 * Adds @controller to @widget so that it will receive events. 567 * 568 * You will usually want to call this function right after 569 * creating any kind of [class@Gtk.EventController]. 570 * 571 * Params: 572 * controller = a `GtkEventController` that hasn't been 573 * added to a widget yet 574 */ 575 public void addController(EventController controller) 576 { 577 gtk_widget_add_controller(gtkWidget, (controller is null) ? null : controller.getEventControllerStruct()); 578 } 579 580 /** 581 * Adds a style class to @widget. 582 * 583 * After calling this function, the widgets style will match 584 * for @css_class, according to CSS matching rules. 585 * 586 * Use [method@Gtk.Widget.remove_css_class] to remove the 587 * style again. 588 * 589 * Params: 590 * cssClass = The style class to add to @widget, without 591 * the leading '.' used for notation of style classes 592 */ 593 public void addCssClass(string cssClass) 594 { 595 gtk_widget_add_css_class(gtkWidget, Str.toStringz(cssClass)); 596 } 597 598 /** 599 * Adds a widget to the list of mnemonic labels for this widget. 600 * 601 * See [method@Gtk.Widget.list_mnemonic_labels]. Note the 602 * list of mnemonic labels for the widget is cleared when the 603 * widget is destroyed, so the caller must make sure to update 604 * its internal state at this point as well. 605 * 606 * Params: 607 * label = a `GtkWidget` that acts as a mnemonic label for @widget 608 */ 609 public void addMnemonicLabel(Widget label) 610 { 611 gtk_widget_add_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 612 } 613 614 /** 615 * Queues an animation frame update and adds a callback to be called 616 * before each frame. 617 * 618 * Until the tick callback is removed, it will be called frequently 619 * (usually at the frame rate of the output device or as quickly as 620 * the application can be repainted, whichever is slower). For this 621 * reason, is most suitable for handling graphics that change every 622 * frame or every few frames. The tick callback does not automatically 623 * imply a relayout or repaint. If you want a repaint or relayout, and 624 * aren’t changing widget properties that would trigger that (for example, 625 * changing the text of a `GtkLabel`), then you will have to call 626 * [method@Gtk.Widget.queue_resize] or [method@Gtk.Widget.queue_draw] 627 * yourself. 628 * 629 * [method@Gdk.FrameClock.get_frame_time] should generally be used 630 * for timing continuous animations and 631 * [method@Gdk.FrameTimings.get_predicted_presentation_time] if you are 632 * trying to display isolated frames at particular times. 633 * 634 * This is a more convenient alternative to connecting directly to the 635 * [signal@Gdk.FrameClock::update] signal of `GdkFrameClock`, since you 636 * don't have to worry about when a `GdkFrameClock` is assigned to a widget. 637 * 638 * Params: 639 * callback = function to call for updating animations 640 * userData = data to pass to @callback 641 * notify = function to call to free @user_data when the callback is removed. 642 * 643 * Returns: an id for the connection of this callback. Remove the callback 644 * by passing the id returned from this function to 645 * [method@Gtk.Widget.remove_tick_callback] 646 */ 647 public uint addTickCallback(GtkTickCallback callback, void* userData, GDestroyNotify notify) 648 { 649 return gtk_widget_add_tick_callback(gtkWidget, callback, userData, notify); 650 } 651 652 /** 653 * This function is only used by `GtkWidget` subclasses, to 654 * assign a size, position and (optionally) baseline to their 655 * child widgets. 656 * 657 * In this function, the allocation and baseline may be adjusted. 658 * The given allocation will be forced to be bigger than the 659 * widget's minimum size, as well as at least 0×0 in size. 660 * 661 * For a version that does not take a transform, see 662 * [method@Gtk.Widget.size_allocate]. 663 * 664 * Params: 665 * width = New width of @widget 666 * height = New height of @widget 667 * baseline = New baseline of @widget, or -1 668 * transform = Transformation to be applied to @widget 669 */ 670 public void allocate(int width, int height, int baseline, Transform transform) 671 { 672 gtk_widget_allocate(gtkWidget, width, height, baseline, (transform is null) ? null : transform.getTransformStruct(true)); 673 } 674 675 /** 676 * Called by widgets as the user moves around the window using 677 * keyboard shortcuts. 678 * 679 * The @direction argument indicates what kind of motion is taking place (up, 680 * down, left, right, tab forward, tab backward). 681 * 682 * This function calls the [vfunc@Gtk.Widget.focus] virtual function; widgets 683 * can override the virtual function in order to implement appropriate focus 684 * behavior. 685 * 686 * The default `focus()` virtual function for a widget should return `TRUE` if 687 * moving in @direction left the focus on a focusable location inside that 688 * widget, and `FALSE` if moving in @direction moved the focus outside the 689 * widget. When returning `TRUE`, widgets normallycall [method@Gtk.Widget.grab_focus] 690 * to place the focus accordingly; when returning `FALSE`, they don’t modify 691 * the current focus location. 692 * 693 * This function is used by custom widget implementations; if you're 694 * writing an app, you’d use [method@Gtk.Widget.grab_focus] to move 695 * the focus to a particular widget. 696 * 697 * Params: 698 * direction = direction of focus movement 699 * 700 * Returns: %TRUE if focus ended up inside @widget 701 */ 702 public bool childFocus(GtkDirectionType direction) 703 { 704 return gtk_widget_child_focus(gtkWidget, direction) != 0; 705 } 706 707 /** 708 * Computes the bounds for @widget in the coordinate space of @target. 709 * 710 * FIXME: Explain what "bounds" are. 711 * 712 * If the operation is successful, %TRUE is returned. If @widget has no 713 * bounds or the bounds cannot be expressed in @target's coordinate space 714 * (for example if both widgets are in different windows), %FALSE is 715 * returned and @bounds is set to the zero rectangle. 716 * 717 * It is valid for @widget and @target to be the same widget. 718 * 719 * Params: 720 * target = the `GtkWidget` 721 * outBounds = the rectangle taking the bounds 722 * 723 * Returns: %TRUE if the bounds could be computed 724 */ 725 public bool computeBounds(Widget target, out Rect outBounds) 726 { 727 graphene_rect_t* outoutBounds = sliceNew!graphene_rect_t(); 728 729 auto __p = gtk_widget_compute_bounds(gtkWidget, (target is null) ? null : target.getWidgetStruct(), outoutBounds) != 0; 730 731 outBounds = ObjectG.getDObject!(Rect)(outoutBounds, true); 732 733 return __p; 734 } 735 736 /** 737 * Computes whether a container should give this widget 738 * extra space when possible. 739 * 740 * Containers should check this, rather than looking at 741 * [method@Gtk.Widget.get_hexpand] or [method@Gtk.Widget.get_vexpand]. 742 * 743 * This function already checks whether the widget is visible, so 744 * visibility does not need to be checked separately. Non-visible 745 * widgets are not expanded. 746 * 747 * The computed expand value uses either the expand setting explicitly 748 * set on the widget itself, or, if none has been explicitly set, 749 * the widget may expand if some of its children do. 750 * 751 * Params: 752 * orientation = expand direction 753 * 754 * Returns: whether widget tree rooted here should be expanded 755 */ 756 public bool computeExpand(GtkOrientation orientation) 757 { 758 return gtk_widget_compute_expand(gtkWidget, orientation) != 0; 759 } 760 761 /** 762 * Translates the given @point in @widget's coordinates to coordinates 763 * relative to @target’s coordinate system. 764 * 765 * In order to perform this operation, both widgets must share a 766 * common ancestor. 767 * 768 * Params: 769 * target = the `GtkWidget` to transform into 770 * point = a point in @widget's coordinate system 771 * outPoint = Set to the corresponding coordinates in 772 * @target's coordinate system 773 * 774 * Returns: %TRUE if the point could be determined, %FALSE on failure. 775 * In this case, 0 is stored in @out_point. 776 */ 777 public bool computePoint(Widget target, Point point, out Point outPoint) 778 { 779 graphene_point_t* outoutPoint = sliceNew!graphene_point_t(); 780 781 auto __p = gtk_widget_compute_point(gtkWidget, (target is null) ? null : target.getWidgetStruct(), (point is null) ? null : point.getPointStruct(), outoutPoint) != 0; 782 783 outPoint = ObjectG.getDObject!(Point)(outoutPoint, true); 784 785 return __p; 786 } 787 788 /** 789 * Computes a matrix suitable to describe a transformation from 790 * @widget's coordinate system into @target's coordinate system. 791 * 792 * The transform can not be computed in certain cases, for example 793 * when @widget and @target do not share a common ancestor. In that 794 * case @out_transform gets set to the identity matrix. 795 * 796 * Params: 797 * target = the target widget that the matrix will transform to 798 * outTransform = location to 799 * store the final transformation 800 * 801 * Returns: %TRUE if the transform could be computed, %FALSE otherwise 802 */ 803 public bool computeTransform(Widget target, out Matrix outTransform) 804 { 805 graphene_matrix_t* outoutTransform = sliceNew!graphene_matrix_t(); 806 807 auto __p = gtk_widget_compute_transform(gtkWidget, (target is null) ? null : target.getWidgetStruct(), outoutTransform) != 0; 808 809 outTransform = ObjectG.getDObject!(Matrix)(outoutTransform, true); 810 811 return __p; 812 } 813 814 /** 815 * Tests if the point at (@x, @y) is contained in @widget. 816 * 817 * The coordinates for (@x, @y) must be in widget coordinates, so 818 * (0, 0) is assumed to be the top left of @widget's content area. 819 * 820 * Params: 821 * x = X coordinate to test, relative to @widget's origin 822 * y = Y coordinate to test, relative to @widget's origin 823 * 824 * Returns: %TRUE if @widget contains (@x, @y). 825 */ 826 public bool contains(double x, double y) 827 { 828 return gtk_widget_contains(gtkWidget, x, y) != 0; 829 } 830 831 /** 832 * Creates a new `PangoContext` with the appropriate font map, 833 * font options, font description, and base direction for drawing 834 * text for this widget. 835 * 836 * See also [method@Gtk.Widget.get_pango_context]. 837 * 838 * Returns: the new `PangoContext` 839 */ 840 public PgContext createPangoContext() 841 { 842 auto __p = gtk_widget_create_pango_context(gtkWidget); 843 844 if(__p is null) 845 { 846 return null; 847 } 848 849 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) __p, true); 850 } 851 852 /** 853 * Creates a new `PangoLayout` with the appropriate font map, 854 * font description, and base direction for drawing text for 855 * this widget. 856 * 857 * If you keep a `PangoLayout` created in this way around, 858 * you need to re-create it when the widget `PangoContext` 859 * is replaced. This can be tracked by listening to changes 860 * of the [property@Gtk.Widget:root] property on the widget. 861 * 862 * Params: 863 * text = text to set on the layout 864 * 865 * Returns: the new `PangoLayout` 866 */ 867 public PgLayout createPangoLayout(string text) 868 { 869 auto __p = gtk_widget_create_pango_layout(gtkWidget, Str.toStringz(text)); 870 871 if(__p is null) 872 { 873 return null; 874 } 875 876 return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) __p, true); 877 } 878 879 /** 880 * Checks to see if a drag movement has passed the GTK drag threshold. 881 * 882 * Params: 883 * startX = X coordinate of start of drag 884 * startY = Y coordinate of start of drag 885 * currentX = current X coordinate 886 * currentY = current Y coordinate 887 * 888 * Returns: %TRUE if the drag threshold has been passed. 889 */ 890 public bool dragCheckThreshold(int startX, int startY, int currentX, int currentY) 891 { 892 return gtk_drag_check_threshold(gtkWidget, startX, startY, currentX, currentY) != 0; 893 } 894 895 /** 896 * Notifies the user about an input-related error on this widget. 897 * 898 * If the [property@Gtk.Settings:gtk-error-bell] setting is %TRUE, 899 * it calls [method@Gdk.Surface.beep], otherwise it does nothing. 900 * 901 * Note that the effect of [method@Gdk.Surface.beep] can be configured 902 * in many ways, depending on the windowing backend and the desktop 903 * environment or window manager that is used. 904 */ 905 public void errorBell() 906 { 907 gtk_widget_error_bell(gtkWidget); 908 } 909 910 /** 911 * Returns the baseline that has currently been allocated to @widget. 912 * 913 * This function is intended to be used when implementing handlers 914 * for the `GtkWidget`Class.snapshot() function, and when allocating 915 * child widgets in `GtkWidget`Class.size_allocate(). 916 * 917 * Returns: the baseline of the @widget, or -1 if none 918 */ 919 public int getAllocatedBaseline() 920 { 921 return gtk_widget_get_allocated_baseline(gtkWidget); 922 } 923 924 /** 925 * Returns the height that has currently been allocated to @widget. 926 * 927 * Returns: the height of the @widget 928 */ 929 public int getAllocatedHeight() 930 { 931 return gtk_widget_get_allocated_height(gtkWidget); 932 } 933 934 /** 935 * Returns the width that has currently been allocated to @widget. 936 * 937 * Returns: the width of the @widget 938 */ 939 public int getAllocatedWidth() 940 { 941 return gtk_widget_get_allocated_width(gtkWidget); 942 } 943 944 /** 945 * Retrieves the widget’s allocation. 946 * 947 * Note, when implementing a layout container: a widget’s allocation 948 * will be its “adjusted” allocation, that is, the widget’s parent 949 * typically calls [method@Gtk.Widget.size_allocate] with an allocation, 950 * and that allocation is then adjusted (to handle margin 951 * and alignment for example) before assignment to the widget. 952 * [method@Gtk.Widget.get_allocation] returns the adjusted allocation that 953 * was actually assigned to the widget. The adjusted allocation is 954 * guaranteed to be completely contained within the 955 * [method@Gtk.Widget.size_allocate] allocation, however. 956 * 957 * So a layout container is guaranteed that its children stay inside 958 * the assigned bounds, but not that they have exactly the bounds the 959 * container assigned. 960 * 961 * Params: 962 * allocation = a pointer to a `GtkAllocation` to copy to 963 */ 964 public void getAllocation(out GtkAllocation allocation) 965 { 966 gtk_widget_get_allocation(gtkWidget, &allocation); 967 } 968 969 /** 970 * Gets the first ancestor of @widget with type @widget_type. 971 * 972 * For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` 973 * gets the first `GtkBox` that’s an ancestor of @widget. No 974 * reference will be added to the returned widget; it should 975 * not be unreferenced. 976 * 977 * Note that unlike [method@Gtk.Widget.is_ancestor], this function 978 * considers @widget to be an ancestor of itself. 979 * 980 * Params: 981 * widgetType = ancestor type 982 * 983 * Returns: the ancestor widget 984 */ 985 public Widget getAncestor(GType widgetType) 986 { 987 auto __p = gtk_widget_get_ancestor(gtkWidget, widgetType); 988 989 if(__p is null) 990 { 991 return null; 992 } 993 994 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 995 } 996 997 /** 998 * Determines whether the input focus can enter @widget or any 999 * of its children. 1000 * 1001 * See [method@Gtk.Widget.set_focusable]. 1002 * 1003 * Returns: %TRUE if the input focus can enter @widget, %FALSE otherwise 1004 */ 1005 public bool getCanFocus() 1006 { 1007 return gtk_widget_get_can_focus(gtkWidget) != 0; 1008 } 1009 1010 /** 1011 * Queries whether @widget can be the target of pointer events. 1012 * 1013 * Returns: %TRUE if @widget can receive pointer events 1014 */ 1015 public bool getCanTarget() 1016 { 1017 return gtk_widget_get_can_target(gtkWidget) != 0; 1018 } 1019 1020 /** 1021 * Gets the value set with gtk_widget_set_child_visible(). 1022 * 1023 * If you feel a need to use this function, your code probably 1024 * needs reorganization. 1025 * 1026 * This function is only useful for container implementations 1027 * and should never be called by an application. 1028 * 1029 * Returns: %TRUE if the widget is mapped with the parent. 1030 */ 1031 public bool getChildVisible() 1032 { 1033 return gtk_widget_get_child_visible(gtkWidget) != 0; 1034 } 1035 1036 /** 1037 * Gets the clipboard object for @widget. 1038 * 1039 * This is a utility function to get the clipboard object for the 1040 * `GdkDisplay` that @widget is using. 1041 * 1042 * Note that this function always works, even when @widget is not 1043 * realized yet. 1044 * 1045 * Returns: the appropriate clipboard object 1046 */ 1047 public Clipboard getClipboard() 1048 { 1049 auto __p = gtk_widget_get_clipboard(gtkWidget); 1050 1051 if(__p is null) 1052 { 1053 return null; 1054 } 1055 1056 return ObjectG.getDObject!(Clipboard)(cast(GdkClipboard*) __p); 1057 } 1058 1059 /** 1060 * Returns the list of style classes applied to @widget. 1061 * 1062 * Returns: a %NULL-terminated list of 1063 * css classes currently applied to @widget. The returned 1064 * list must freed using g_strfreev(). 1065 */ 1066 public string[] getCssClasses() 1067 { 1068 auto retStr = gtk_widget_get_css_classes(gtkWidget); 1069 1070 scope(exit) Str.freeStringArray(retStr); 1071 return Str.toStringArray(retStr); 1072 } 1073 1074 /** 1075 * Returns the CSS name that is used for @self. 1076 * 1077 * Returns: the CSS name 1078 */ 1079 public string getCssName() 1080 { 1081 return Str.toString(gtk_widget_get_css_name(gtkWidget)); 1082 } 1083 1084 /** 1085 * Queries the cursor set on @widget. 1086 * 1087 * See [method@Gtk.Widget.set_cursor] for details. 1088 * 1089 * Returns: the cursor 1090 * currently in use or %NULL if the cursor is inherited 1091 */ 1092 public Cursor getCursor() 1093 { 1094 auto __p = gtk_widget_get_cursor(gtkWidget); 1095 1096 if(__p is null) 1097 { 1098 return null; 1099 } 1100 1101 return ObjectG.getDObject!(Cursor)(cast(GdkCursor*) __p); 1102 } 1103 1104 /** 1105 * Gets the reading direction for a particular widget. 1106 * 1107 * See [method@Gtk.Widget.set_direction]. 1108 * 1109 * Returns: the reading direction for the widget. 1110 */ 1111 public GtkTextDirection getDirection() 1112 { 1113 return gtk_widget_get_direction(gtkWidget); 1114 } 1115 1116 /** 1117 * Get the `GdkDisplay` for the toplevel window associated with 1118 * this widget. 1119 * 1120 * This function can only be called after the widget has been 1121 * added to a widget hierarchy with a `GtkWindow` at the top. 1122 * 1123 * In general, you should only create display specific 1124 * resources when a widget has been realized, and you should 1125 * free those resources when the widget is unrealized. 1126 * 1127 * Returns: the `GdkDisplay` for the toplevel 1128 * for this widget. 1129 */ 1130 public Display getDisplay() 1131 { 1132 auto __p = gtk_widget_get_display(gtkWidget); 1133 1134 if(__p is null) 1135 { 1136 return null; 1137 } 1138 1139 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p); 1140 } 1141 1142 /** 1143 * Returns the widgets first child. 1144 * 1145 * This API is primarily meant for widget implementations. 1146 * 1147 * Returns: The widget's first child 1148 */ 1149 public Widget getFirstChild() 1150 { 1151 auto __p = gtk_widget_get_first_child(gtkWidget); 1152 1153 if(__p is null) 1154 { 1155 return null; 1156 } 1157 1158 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1159 } 1160 1161 /** 1162 * Returns the current focus child of @widget. 1163 * 1164 * Returns: The current focus 1165 * child of @widget 1166 */ 1167 public Widget getFocusChild() 1168 { 1169 auto __p = gtk_widget_get_focus_child(gtkWidget); 1170 1171 if(__p is null) 1172 { 1173 return null; 1174 } 1175 1176 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1177 } 1178 1179 /** 1180 * Returns whether the widget should grab focus when it is clicked 1181 * with the mouse. 1182 * 1183 * See [method@Gtk.Widget.set_focus_on_click]. 1184 * 1185 * Returns: %TRUE if the widget should grab focus when it is 1186 * clicked with the mouse 1187 */ 1188 public bool getFocusOnClick() 1189 { 1190 return gtk_widget_get_focus_on_click(gtkWidget) != 0; 1191 } 1192 1193 /** 1194 * Determines whether @widget can own the input focus. 1195 * 1196 * See [method@Gtk.Widget.set_focusable]. 1197 * 1198 * Returns: %TRUE if @widget can own the input focus, %FALSE otherwise 1199 */ 1200 public bool getFocusable() 1201 { 1202 return gtk_widget_get_focusable(gtkWidget) != 0; 1203 } 1204 1205 /** 1206 * Gets the font map of @widget. 1207 * 1208 * See [method@Gtk.Widget.set_font_map]. 1209 * 1210 * Returns: A `PangoFontMap` 1211 */ 1212 public PgFontMap getFontMap() 1213 { 1214 auto __p = gtk_widget_get_font_map(gtkWidget); 1215 1216 if(__p is null) 1217 { 1218 return null; 1219 } 1220 1221 return ObjectG.getDObject!(PgFontMap)(cast(PangoFontMap*) __p); 1222 } 1223 1224 /** 1225 * Returns the `cairo_font_options_t` of widget. 1226 * 1227 * Seee [method@Gtk.Widget.set_font_options]. 1228 * 1229 * Returns: the `cairo_font_options_t` 1230 * of widget 1231 */ 1232 public FontOption getFontOptions() 1233 { 1234 auto __p = gtk_widget_get_font_options(gtkWidget); 1235 1236 if(__p is null) 1237 { 1238 return null; 1239 } 1240 1241 return new FontOption(cast(cairo_font_options_t*) __p); 1242 } 1243 1244 /** 1245 * Obtains the frame clock for a widget. 1246 * 1247 * The frame clock is a global “ticker” that can be used to drive 1248 * animations and repaints. The most common reason to get the frame 1249 * clock is to call [method@Gdk.FrameClock.get_frame_time], in order 1250 * to get a time to use for animating. For example you might record 1251 * the start of the animation with an initial value from 1252 * [method@Gdk.FrameClock.get_frame_time], and then update the animation 1253 * by calling [method@Gdk.FrameClock.get_frame_time] again during each repaint. 1254 * 1255 * [method@Gdk.FrameClock.request_phase] will result in a new frame on the 1256 * clock, but won’t necessarily repaint any widgets. To repaint a 1257 * widget, you have to use [method@Gtk.Widget.queue_draw] which invalidates 1258 * the widget (thus scheduling it to receive a draw on the next 1259 * frame). gtk_widget_queue_draw() will also end up requesting a frame 1260 * on the appropriate frame clock. 1261 * 1262 * A widget’s frame clock will not change while the widget is 1263 * mapped. Reparenting a widget (which implies a temporary unmap) can 1264 * change the widget’s frame clock. 1265 * 1266 * Unrealized widgets do not have a frame clock. 1267 * 1268 * Returns: a `GdkFrameClock` 1269 */ 1270 public FrameClock getFrameClock() 1271 { 1272 auto __p = gtk_widget_get_frame_clock(gtkWidget); 1273 1274 if(__p is null) 1275 { 1276 return null; 1277 } 1278 1279 return ObjectG.getDObject!(FrameClock)(cast(GdkFrameClock*) __p); 1280 } 1281 1282 /** 1283 * Gets the horizontal alignment of @widget. 1284 * 1285 * For backwards compatibility reasons this method will never return 1286 * %GTK_ALIGN_BASELINE, but instead it will convert it to 1287 * %GTK_ALIGN_FILL. Baselines are not supported for horizontal 1288 * alignment. 1289 * 1290 * Returns: the horizontal alignment of @widget 1291 */ 1292 public GtkAlign getHalign() 1293 { 1294 return gtk_widget_get_halign(gtkWidget); 1295 } 1296 1297 /** 1298 * Returns the current value of the `has-tooltip` property. 1299 * 1300 * Returns: current value of `has-tooltip` on @widget. 1301 */ 1302 public bool getHasTooltip() 1303 { 1304 return gtk_widget_get_has_tooltip(gtkWidget) != 0; 1305 } 1306 1307 /** 1308 * Returns the content height of the widget. 1309 * 1310 * This function returns the height passed to its 1311 * size-allocate implementation, which is the height you 1312 * should be using in [vfunc@Gtk.Widget.snapshot]. 1313 * 1314 * For pointer events, see [method@Gtk.Widget.contains]. 1315 * 1316 * Returns: The height of @widget 1317 */ 1318 public int getHeight() 1319 { 1320 return gtk_widget_get_height(gtkWidget); 1321 } 1322 1323 /** 1324 * Gets whether the widget would like any available extra horizontal 1325 * space. 1326 * 1327 * When a user resizes a `GtkWindow`, widgets with expand=TRUE 1328 * generally receive the extra space. For example, a list or 1329 * scrollable area or document in your window would often be set to 1330 * expand. 1331 * 1332 * Containers should use [method@Gtk.Widget.compute_expand] rather 1333 * than this function, to see whether a widget, or any of its children, 1334 * has the expand flag set. If any child of a widget wants to 1335 * expand, the parent may ask to expand also. 1336 * 1337 * This function only looks at the widget’s own hexpand flag, rather 1338 * than computing whether the entire widget tree rooted at this widget 1339 * wants to expand. 1340 * 1341 * Returns: whether hexpand flag is set 1342 */ 1343 public bool getHexpand() 1344 { 1345 return gtk_widget_get_hexpand(gtkWidget) != 0; 1346 } 1347 1348 /** 1349 * Gets whether gtk_widget_set_hexpand() has been used 1350 * to explicitly set the expand flag on this widget. 1351 * 1352 * If [property@Gtk.Widget:hexpand] property is set, then it 1353 * overrides any computed expand value based on child widgets. 1354 * If `hexpand` is not set, then the expand value depends on 1355 * whether any children of the widget would like to expand. 1356 * 1357 * There are few reasons to use this function, but it’s here 1358 * for completeness and consistency. 1359 * 1360 * Returns: whether hexpand has been explicitly set 1361 */ 1362 public bool getHexpandSet() 1363 { 1364 return gtk_widget_get_hexpand_set(gtkWidget) != 0; 1365 } 1366 1367 /** 1368 * Returns the widgets last child. 1369 * 1370 * This API is primarily meant for widget implementations. 1371 * 1372 * Returns: The widget's last child 1373 */ 1374 public Widget getLastChild() 1375 { 1376 auto __p = gtk_widget_get_last_child(gtkWidget); 1377 1378 if(__p is null) 1379 { 1380 return null; 1381 } 1382 1383 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1384 } 1385 1386 /** 1387 * Retrieves the layout manager used by @widget. 1388 * 1389 * See [method@Gtk.Widget.set_layout_manager]. 1390 * 1391 * Returns: a `GtkLayoutManager` 1392 */ 1393 public LayoutManager getLayoutManager() 1394 { 1395 auto __p = gtk_widget_get_layout_manager(gtkWidget); 1396 1397 if(__p is null) 1398 { 1399 return null; 1400 } 1401 1402 return ObjectG.getDObject!(LayoutManager)(cast(GtkLayoutManager*) __p); 1403 } 1404 1405 /** 1406 * Whether the widget is mapped. 1407 * 1408 * Returns: %TRUE if the widget is mapped, %FALSE otherwise. 1409 */ 1410 public bool getMapped() 1411 { 1412 return gtk_widget_get_mapped(gtkWidget) != 0; 1413 } 1414 1415 /** 1416 * Gets the bottom margin of @widget. 1417 * 1418 * Returns: The bottom margin of @widget 1419 */ 1420 public int getMarginBottom() 1421 { 1422 return gtk_widget_get_margin_bottom(gtkWidget); 1423 } 1424 1425 /** 1426 * Gets the end margin of @widget. 1427 * 1428 * Returns: The end margin of @widget 1429 */ 1430 public int getMarginEnd() 1431 { 1432 return gtk_widget_get_margin_end(gtkWidget); 1433 } 1434 1435 /** 1436 * Gets the start margin of @widget. 1437 * 1438 * Returns: The start margin of @widget 1439 */ 1440 public int getMarginStart() 1441 { 1442 return gtk_widget_get_margin_start(gtkWidget); 1443 } 1444 1445 /** 1446 * Gets the top margin of @widget. 1447 * 1448 * Returns: The top margin of @widget 1449 */ 1450 public int getMarginTop() 1451 { 1452 return gtk_widget_get_margin_top(gtkWidget); 1453 } 1454 1455 /** 1456 * Retrieves the name of a widget. 1457 * 1458 * See [method@Gtk.Widget.set_name] for the significance of widget names. 1459 * 1460 * Returns: name of the widget. This string is owned by GTK and 1461 * should not be modified or freed 1462 */ 1463 public string getName() 1464 { 1465 return Str.toString(gtk_widget_get_name(gtkWidget)); 1466 } 1467 1468 /** 1469 * Returns the nearest `GtkNative` ancestor of @widget. 1470 * 1471 * This function will return %NULL if the widget is not 1472 * contained inside a widget tree with a native ancestor. 1473 * 1474 * `GtkNative` widgets will return themselves here. 1475 * 1476 * Returns: the `GtkNative` ancestor of @widget 1477 */ 1478 public NativeIF getNative() 1479 { 1480 auto __p = gtk_widget_get_native(gtkWidget); 1481 1482 if(__p is null) 1483 { 1484 return null; 1485 } 1486 1487 return ObjectG.getDObject!(NativeIF)(cast(GtkNative*) __p); 1488 } 1489 1490 /** 1491 * Returns the widgets next sibling. 1492 * 1493 * This API is primarily meant for widget implementations. 1494 * 1495 * Returns: The widget's next sibling 1496 */ 1497 public Widget getNextSibling() 1498 { 1499 auto __p = gtk_widget_get_next_sibling(gtkWidget); 1500 1501 if(__p is null) 1502 { 1503 return null; 1504 } 1505 1506 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1507 } 1508 1509 /** 1510 * #Fetches the requested opacity for this widget. 1511 * 1512 * See [method@Gtk.Widget.set_opacity]. 1513 * 1514 * Returns: the requested opacity for this widget. 1515 */ 1516 public double getOpacity() 1517 { 1518 return gtk_widget_get_opacity(gtkWidget); 1519 } 1520 1521 /** 1522 * Returns the widgets overflow value. 1523 * 1524 * Returns: The widget's overflow. 1525 */ 1526 public GtkOverflow getOverflow() 1527 { 1528 return gtk_widget_get_overflow(gtkWidget); 1529 } 1530 1531 /** 1532 * Gets a `PangoContext` with the appropriate font map, font description, 1533 * and base direction for this widget. 1534 * 1535 * Unlike the context returned by [method@Gtk.Widget.create_pango_context], 1536 * this context is owned by the widget (it can be used until the screen 1537 * for the widget changes or the widget is removed from its toplevel), 1538 * and will be updated to match any changes to the widget’s attributes. 1539 * This can be tracked by listening to changes of the 1540 * [property@Gtk.Widget:root] property on the widget. 1541 * 1542 * Returns: the `PangoContext` for the widget. 1543 */ 1544 public PgContext getPangoContext() 1545 { 1546 auto __p = gtk_widget_get_pango_context(gtkWidget); 1547 1548 if(__p is null) 1549 { 1550 return null; 1551 } 1552 1553 return ObjectG.getDObject!(PgContext)(cast(PangoContext*) __p); 1554 } 1555 1556 /** 1557 * Returns the parent widget of @widget. 1558 * 1559 * Returns: the parent widget of @widget 1560 */ 1561 public Widget getParent() 1562 { 1563 auto __p = gtk_widget_get_parent(gtkWidget); 1564 1565 if(__p is null) 1566 { 1567 return null; 1568 } 1569 1570 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1571 } 1572 1573 /** 1574 * Retrieves the minimum and natural size of a widget, taking 1575 * into account the widget’s preference for height-for-width management. 1576 * 1577 * This is used to retrieve a suitable size by container widgets which do 1578 * not impose any restrictions on the child placement. It can be used 1579 * to deduce toplevel window and menu sizes as well as child widgets in 1580 * free-form containers such as `GtkFixed`. 1581 * 1582 * Handle with care. Note that the natural height of a height-for-width 1583 * widget will generally be a smaller size than the minimum height, since 1584 * the required height for the natural width is generally smaller than the 1585 * required height for the minimum width. 1586 * 1587 * Use [id@gtk_widget_measure] if you want to support baseline alignment. 1588 * 1589 * Params: 1590 * minimumSize = location for storing the minimum size 1591 * naturalSize = location for storing the natural size 1592 */ 1593 public void getPreferredSize(out Requisition minimumSize, out Requisition naturalSize) 1594 { 1595 GtkRequisition* outminimumSize = sliceNew!GtkRequisition(); 1596 GtkRequisition* outnaturalSize = sliceNew!GtkRequisition(); 1597 1598 gtk_widget_get_preferred_size(gtkWidget, outminimumSize, outnaturalSize); 1599 1600 minimumSize = ObjectG.getDObject!(Requisition)(outminimumSize, true); 1601 naturalSize = ObjectG.getDObject!(Requisition)(outnaturalSize, true); 1602 } 1603 1604 /** 1605 * Returns the widgets previous sibling. 1606 * 1607 * This API is primarily meant for widget implementations. 1608 * 1609 * Returns: The widget's previous sibling 1610 */ 1611 public Widget getPrevSibling() 1612 { 1613 auto __p = gtk_widget_get_prev_sibling(gtkWidget); 1614 1615 if(__p is null) 1616 { 1617 return null; 1618 } 1619 1620 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 1621 } 1622 1623 /** 1624 * Gets the primary clipboard of @widget. 1625 * 1626 * This is a utility function to get the primary clipboard object 1627 * for the `GdkDisplay` that @widget is using. 1628 * 1629 * Note that this function always works, even when @widget is not 1630 * realized yet. 1631 * 1632 * Returns: the appropriate clipboard object 1633 */ 1634 public Clipboard getPrimaryClipboard() 1635 { 1636 auto __p = gtk_widget_get_primary_clipboard(gtkWidget); 1637 1638 if(__p is null) 1639 { 1640 return null; 1641 } 1642 1643 return ObjectG.getDObject!(Clipboard)(cast(GdkClipboard*) __p); 1644 } 1645 1646 /** 1647 * Determines whether @widget is realized. 1648 * 1649 * Returns: %TRUE if @widget is realized, %FALSE otherwise 1650 */ 1651 public bool getRealized() 1652 { 1653 return gtk_widget_get_realized(gtkWidget) != 0; 1654 } 1655 1656 /** 1657 * Determines whether @widget is always treated as the default widget 1658 * within its toplevel when it has the focus, even if another widget 1659 * is the default. 1660 * 1661 * See [method@Gtk.Widget.set_receives_default]. 1662 * 1663 * Returns: %TRUE if @widget acts as the default widget when focused, 1664 * %FALSE otherwise 1665 */ 1666 public bool getReceivesDefault() 1667 { 1668 return gtk_widget_get_receives_default(gtkWidget) != 0; 1669 } 1670 1671 /** 1672 * Gets whether the widget prefers a height-for-width layout 1673 * or a width-for-height layout. 1674 * 1675 * Single-child widgets generally propagate the preference of 1676 * their child, more complex widgets need to request something 1677 * either in context of their children or in context of their 1678 * allocation capabilities. 1679 * 1680 * Returns: The `GtkSizeRequestMode` preferred by @widget. 1681 */ 1682 public GtkSizeRequestMode getRequestMode() 1683 { 1684 return gtk_widget_get_request_mode(gtkWidget); 1685 } 1686 1687 /** 1688 * Returns the `GtkRoot` widget of @widget. 1689 * 1690 * This function will return %NULL if the widget is not contained 1691 * inside a widget tree with a root widget. 1692 * 1693 * `GtkRoot` widgets will return themselves here. 1694 * 1695 * Returns: the root widget of @widget 1696 */ 1697 public RootIF getRoot() 1698 { 1699 auto __p = gtk_widget_get_root(gtkWidget); 1700 1701 if(__p is null) 1702 { 1703 return null; 1704 } 1705 1706 return ObjectG.getDObject!(RootIF)(cast(GtkRoot*) __p); 1707 } 1708 1709 /** 1710 * Retrieves the internal scale factor that maps from window 1711 * coordinates to the actual device pixels. 1712 * 1713 * On traditional systems this is 1, on high density outputs, 1714 * it can be a higher value (typically 2). 1715 * 1716 * See [method@Gdk.Surface.get_scale_factor]. 1717 * 1718 * Returns: the scale factor for @widget 1719 */ 1720 public int getScaleFactor() 1721 { 1722 return gtk_widget_get_scale_factor(gtkWidget); 1723 } 1724 1725 /** 1726 * Returns the widget’s sensitivity. 1727 * 1728 * This function returns the value that has been set using 1729 * [method@Gtk.Widget.set_sensitive]). 1730 * 1731 * The effective sensitivity of a widget is however determined 1732 * by both its own and its parent widget’s sensitivity. 1733 * See [method@Gtk.Widget.is_sensitive]. 1734 * 1735 * Returns: %TRUE if the widget is sensitive 1736 */ 1737 public bool getSensitive() 1738 { 1739 return gtk_widget_get_sensitive(gtkWidget) != 0; 1740 } 1741 1742 /** 1743 * Gets the settings object holding the settings used for this widget. 1744 * 1745 * Note that this function can only be called when the `GtkWidget` 1746 * is attached to a toplevel, since the settings object is specific 1747 * to a particular `GdkDisplay`. If you want to monitor the widget for 1748 * changes in its settings, connect to the `notify::display` signal. 1749 * 1750 * Returns: the relevant `GtkSettings` object 1751 */ 1752 public Settings getSettings() 1753 { 1754 auto __p = gtk_widget_get_settings(gtkWidget); 1755 1756 if(__p is null) 1757 { 1758 return null; 1759 } 1760 1761 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) __p); 1762 } 1763 1764 /** 1765 * Returns the content width or height of the widget. 1766 * 1767 * Which dimension is returned depends on @orientation. 1768 * 1769 * This is equivalent to calling [method@Gtk.Widget.get_width] 1770 * for %GTK_ORIENTATION_HORIZONTAL or [method@Gtk.Widget.get_height] 1771 * for %GTK_ORIENTATION_VERTICAL, but can be used when 1772 * writing orientation-independent code, such as when 1773 * implementing [iface@Gtk.Orientable] widgets. 1774 * 1775 * Params: 1776 * orientation = the orientation to query 1777 * 1778 * Returns: The size of @widget in @orientation. 1779 */ 1780 public int getSize(GtkOrientation orientation) 1781 { 1782 return gtk_widget_get_size(gtkWidget, orientation); 1783 } 1784 1785 /** 1786 * Gets the size request that was explicitly set for the widget using 1787 * gtk_widget_set_size_request(). 1788 * 1789 * A value of -1 stored in @width or @height indicates that that 1790 * dimension has not been set explicitly and the natural requisition 1791 * of the widget will be used instead. See 1792 * [method@Gtk.Widget.set_size_request]. To get the size a widget will 1793 * actually request, call [method@Gtk.Widget.measure] instead of 1794 * this function. 1795 * 1796 * Params: 1797 * width = return location for width 1798 * height = return location for height 1799 */ 1800 public void getSizeRequest(out int width, out int height) 1801 { 1802 gtk_widget_get_size_request(gtkWidget, &width, &height); 1803 } 1804 1805 /** 1806 * Returns the widget state as a flag set. 1807 * 1808 * It is worth mentioning that the effective %GTK_STATE_FLAG_INSENSITIVE 1809 * state will be returned, that is, also based on parent insensitivity, 1810 * even if @widget itself is sensitive. 1811 * 1812 * Also note that if you are looking for a way to obtain the 1813 * [flags@Gtk.StateFlags] to pass to a [class@Gtk.StyleContext] 1814 * method, you should look at [method@Gtk.StyleContext.get_state]. 1815 * 1816 * Returns: The state flags for widget 1817 */ 1818 public GtkStateFlags getStateFlags() 1819 { 1820 return gtk_widget_get_state_flags(gtkWidget); 1821 } 1822 1823 /** 1824 * Returns the style context associated to @widget. 1825 * 1826 * The returned object is guaranteed to be the same 1827 * for the lifetime of @widget. 1828 * 1829 * Returns: the widgets `GtkStyleContext` 1830 */ 1831 public StyleContext getStyleContext() 1832 { 1833 auto __p = gtk_widget_get_style_context(gtkWidget); 1834 1835 if(__p is null) 1836 { 1837 return null; 1838 } 1839 1840 return ObjectG.getDObject!(StyleContext)(cast(GtkStyleContext*) __p); 1841 } 1842 1843 /** 1844 * Fetch an object build from the template XML for @widget_type in 1845 * this @widget instance. 1846 * 1847 * This will only report children which were previously declared 1848 * with [method@Gtk.WidgetClass.bind_template_child_full] or one of its 1849 * variants. 1850 * 1851 * This function is only meant to be called for code which is private 1852 * to the @widget_type which declared the child and is meant for language 1853 * bindings which cannot easily make use of the GObject structure offsets. 1854 * 1855 * Params: 1856 * widgetType = The `GType` to get a template child for 1857 * name = The “id” of the child defined in the template XML 1858 * 1859 * Returns: The object built in the template XML with 1860 * the id @name 1861 */ 1862 public ObjectG getTemplateChild(GType widgetType, string name) 1863 { 1864 auto __p = gtk_widget_get_template_child(gtkWidget, widgetType, Str.toStringz(name)); 1865 1866 if(__p is null) 1867 { 1868 return null; 1869 } 1870 1871 return ObjectG.getDObject!(ObjectG)(cast(GObject*) __p); 1872 } 1873 1874 /** 1875 * Gets the contents of the tooltip for @widget. 1876 * 1877 * If the tooltip has not been set using 1878 * [method@Gtk.Widget.set_tooltip_markup], this 1879 * function returns %NULL. 1880 * 1881 * Returns: the tooltip text 1882 */ 1883 public string getTooltipMarkup() 1884 { 1885 return Str.toString(gtk_widget_get_tooltip_markup(gtkWidget)); 1886 } 1887 1888 /** 1889 * Gets the contents of the tooltip for @widget. 1890 * 1891 * If the @widget's tooltip was set using 1892 * [method@Gtk.Widget.set_tooltip_markup], 1893 * this function will return the escaped text. 1894 * 1895 * Returns: the tooltip text 1896 */ 1897 public string getTooltipText() 1898 { 1899 return Str.toString(gtk_widget_get_tooltip_text(gtkWidget)); 1900 } 1901 1902 /** 1903 * Gets the vertical alignment of @widget. 1904 * 1905 * Returns: the vertical alignment of @widget 1906 */ 1907 public GtkAlign getValign() 1908 { 1909 return gtk_widget_get_valign(gtkWidget); 1910 } 1911 1912 /** 1913 * Gets whether the widget would like any available extra vertical 1914 * space. 1915 * 1916 * See [method@Gtk.Widget.get_hexpand] for more detail. 1917 * 1918 * Returns: whether vexpand flag is set 1919 */ 1920 public bool getVexpand() 1921 { 1922 return gtk_widget_get_vexpand(gtkWidget) != 0; 1923 } 1924 1925 /** 1926 * Gets whether gtk_widget_set_vexpand() has been used to 1927 * explicitly set the expand flag on this widget. 1928 * 1929 * See [method@Gtk.Widget.get_hexpand_set] for more detail. 1930 * 1931 * Returns: whether vexpand has been explicitly set 1932 */ 1933 public bool getVexpandSet() 1934 { 1935 return gtk_widget_get_vexpand_set(gtkWidget) != 0; 1936 } 1937 1938 /** 1939 * Determines whether the widget is visible. 1940 * 1941 * If you want to take into account whether the widget’s 1942 * parent is also marked as visible, use 1943 * [method@Gtk.Widget.is_visible] instead. 1944 * 1945 * This function does not check if the widget is 1946 * obscured in any way. 1947 * 1948 * See [method@Gtk.Widget.set_visible]. 1949 * 1950 * Returns: %TRUE if the widget is visible 1951 */ 1952 public bool getVisible() 1953 { 1954 return gtk_widget_get_visible(gtkWidget) != 0; 1955 } 1956 1957 /** 1958 * Returns the content width of the widget. 1959 * 1960 * This function returns the width passed to its 1961 * size-allocate implementation, which is the width you 1962 * should be using in [vfunc@Gtk.Widget.snapshot]. 1963 * 1964 * For pointer events, see [method@Gtk.Widget.contains]. 1965 * 1966 * Returns: The width of @widget 1967 */ 1968 public int getWidth() 1969 { 1970 return gtk_widget_get_width(gtkWidget); 1971 } 1972 1973 /** 1974 * Causes @widget to have the keyboard focus for the `GtkWindow` it's inside. 1975 * 1976 * If @widget is not focusable, or its [vfunc@Gtk.Widget.grab_focus] 1977 * implementation cannot transfer the focus to a descendant of @widget 1978 * that is focusable, it will not take focus and %FALSE will be returned. 1979 * 1980 * Calling [method@Gtk.Widget.grab_focus] on an already focused widget 1981 * is allowed, should not have an effect, and return %TRUE. 1982 * 1983 * Returns: %TRUE if focus is now inside @widget. 1984 */ 1985 public bool grabFocus() 1986 { 1987 return gtk_widget_grab_focus(gtkWidget) != 0; 1988 } 1989 1990 /** 1991 * Returns whether @css_class is currently applied to @widget. 1992 * 1993 * Params: 1994 * cssClass = A style class, without the leading '.' 1995 * used for notation of style classes 1996 * 1997 * Returns: %TRUE if @css_class is currently applied to @widget, 1998 * %FALSE otherwise. 1999 */ 2000 public bool hasCssClass(string cssClass) 2001 { 2002 return gtk_widget_has_css_class(gtkWidget, Str.toStringz(cssClass)) != 0; 2003 } 2004 2005 /** 2006 * Determines whether @widget is the current default widget 2007 * within its toplevel. 2008 * 2009 * Returns: %TRUE if @widget is the current default widget 2010 * within its toplevel, %FALSE otherwise 2011 */ 2012 public bool hasDefault() 2013 { 2014 return gtk_widget_has_default(gtkWidget) != 0; 2015 } 2016 2017 /** 2018 * Determines if the widget has the global input focus. 2019 * 2020 * See [method@Gtk.Widget.is_focus] for the difference between 2021 * having the global input focus, and only having the focus 2022 * within a toplevel. 2023 * 2024 * Returns: %TRUE if the widget has the global input focus. 2025 */ 2026 public bool hasFocus() 2027 { 2028 return gtk_widget_has_focus(gtkWidget) != 0; 2029 } 2030 2031 /** 2032 * Determines if the widget should show a visible indication that 2033 * it has the global input focus. 2034 * 2035 * This is a convenience function that takes into account whether 2036 * focus indication should currently be shown in the toplevel window 2037 * of @widget. See [method@Gtk.Window.get_focus_visible] for more 2038 * information about focus indication. 2039 * 2040 * To find out if the widget has the global input focus, use 2041 * [method@Gtk.Widget.has_focus]. 2042 * 2043 * Returns: %TRUE if the widget should display a “focus rectangle” 2044 */ 2045 public bool hasVisibleFocus() 2046 { 2047 return gtk_widget_has_visible_focus(gtkWidget) != 0; 2048 } 2049 2050 /** 2051 * Reverses the effects of gtk_widget_show(). 2052 * 2053 * This is causing the widget to be hidden (invisible to the user). 2054 */ 2055 public void hide() 2056 { 2057 gtk_widget_hide(gtkWidget); 2058 } 2059 2060 /** 2061 * Returns whether the widget is currently being destroyed. 2062 * 2063 * This information can sometimes be used to avoid doing 2064 * unnecessary work. 2065 * 2066 * Returns: %TRUE if @widget is being destroyed 2067 */ 2068 public bool inDestruction() 2069 { 2070 return gtk_widget_in_destruction(gtkWidget) != 0; 2071 } 2072 2073 /** 2074 * Creates and initializes child widgets defined in templates. 2075 * 2076 * This function must be called in the instance initializer 2077 * for any class which assigned itself a template using 2078 * [method@Gtk.WidgetClass.set_template]. 2079 * 2080 * It is important to call this function in the instance initializer 2081 * of a `GtkWidget` subclass and not in `GObject.constructed()` or 2082 * `GObject.constructor()` for two reasons: 2083 * 2084 * - derived widgets will assume that the composite widgets 2085 * defined by its parent classes have been created in their 2086 * relative instance initializers 2087 * - when calling `g_object_new()` on a widget with composite templates, 2088 * it’s important to build the composite widgets before the construct 2089 * properties are set. Properties passed to `g_object_new()` should 2090 * take precedence over properties set in the private template XML 2091 * 2092 * A good rule of thumb is to call this function as the first thing in 2093 * an instance initialization function. 2094 */ 2095 public void initTemplate() 2096 { 2097 gtk_widget_init_template(gtkWidget); 2098 } 2099 2100 /** 2101 * Inserts @group into @widget. 2102 * 2103 * Children of @widget that implement [iface@Gtk.Actionable] can 2104 * then be associated with actions in @group by setting their 2105 * “action-name” to @prefix.`action-name`. 2106 * 2107 * Note that inheritance is defined for individual actions. I.e. 2108 * even if you insert a group with prefix @prefix, actions with 2109 * the same prefix will still be inherited from the parent, unless 2110 * the group contains an action with the same name. 2111 * 2112 * If @group is %NULL, a previously inserted group for @name is 2113 * removed from @widget. 2114 * 2115 * Params: 2116 * name = the prefix for actions in @group 2117 * group = a `GActionGroup`, or %NULL to remove 2118 * the previously inserted group for @name 2119 */ 2120 public void insertActionGroup(string name, ActionGroupIF group) 2121 { 2122 gtk_widget_insert_action_group(gtkWidget, Str.toStringz(name), (group is null) ? null : group.getActionGroupStruct()); 2123 } 2124 2125 /** 2126 * Inserts @widget into the child widget list of @parent. 2127 * 2128 * It will be placed after @previous_sibling, or at the beginning if 2129 * @previous_sibling is %NULL. 2130 * 2131 * After calling this function, `gtk_widget_get_prev_sibling(widget)` 2132 * will return @previous_sibling. 2133 * 2134 * If @parent is already set as the parent widget of @widget, this 2135 * function can also be used to reorder @widget in the child widget 2136 * list of @parent. 2137 * 2138 * This API is primarily meant for widget implementations; if you are 2139 * just using a widget, you *must* use its own API for adding children. 2140 * 2141 * Params: 2142 * parent = the parent `GtkWidget` to insert @widget into 2143 * previousSibling = the new previous sibling of @widget 2144 */ 2145 public void insertAfter(Widget parent, Widget previousSibling) 2146 { 2147 gtk_widget_insert_after(gtkWidget, (parent is null) ? null : parent.getWidgetStruct(), (previousSibling is null) ? null : previousSibling.getWidgetStruct()); 2148 } 2149 2150 /** 2151 * Inserts @widget into the child widget list of @parent. 2152 * 2153 * It will be placed before @next_sibling, or at the end if 2154 * @next_sibling is %NULL. 2155 * 2156 * After calling this function, `gtk_widget_get_next_sibling(widget)` 2157 * will return @next_sibling. 2158 * 2159 * If @parent is already set as the parent widget of @widget, this function 2160 * can also be used to reorder @widget in the child widget list of @parent. 2161 * 2162 * This API is primarily meant for widget implementations; if you are 2163 * just using a widget, you *must* use its own API for adding children. 2164 * 2165 * Params: 2166 * parent = the parent `GtkWidget` to insert @widget into 2167 * nextSibling = the new next sibling of @widget 2168 */ 2169 public void insertBefore(Widget parent, Widget nextSibling) 2170 { 2171 gtk_widget_insert_before(gtkWidget, (parent is null) ? null : parent.getWidgetStruct(), (nextSibling is null) ? null : nextSibling.getWidgetStruct()); 2172 } 2173 2174 /** 2175 * Determines whether @widget is somewhere inside @ancestor, 2176 * possibly with intermediate containers. 2177 * 2178 * Params: 2179 * ancestor = another `GtkWidget` 2180 * 2181 * Returns: %TRUE if @ancestor contains @widget as a child, 2182 * grandchild, great grandchild, etc. 2183 */ 2184 public bool isAncestor(Widget ancestor) 2185 { 2186 return gtk_widget_is_ancestor(gtkWidget, (ancestor is null) ? null : ancestor.getWidgetStruct()) != 0; 2187 } 2188 2189 /** 2190 * Determines whether @widget can be drawn to. 2191 * 2192 * A widget can be drawn if it is mapped and visible. 2193 * 2194 * Returns: %TRUE if @widget is drawable, %FALSE otherwise 2195 */ 2196 public bool isDrawable() 2197 { 2198 return gtk_widget_is_drawable(gtkWidget) != 0; 2199 } 2200 2201 /** 2202 * Determines if the widget is the focus widget within its 2203 * toplevel. 2204 * 2205 * This does not mean that the [property@Gtk.Widget:has-focus] 2206 * property is necessarily set; [property@Gtk.Widget:has-focus] 2207 * will only be set if the toplevel widget additionally has the 2208 * global input focus. 2209 * 2210 * Returns: %TRUE if the widget is the focus widget. 2211 */ 2212 public bool isFocus() 2213 { 2214 return gtk_widget_is_focus(gtkWidget) != 0; 2215 } 2216 2217 /** 2218 * Returns the widget’s effective sensitivity. 2219 * 2220 * This means it is sensitive itself and also its 2221 * parent widget is sensitive. 2222 * 2223 * Returns: %TRUE if the widget is effectively sensitive 2224 */ 2225 public bool isSensitive() 2226 { 2227 return gtk_widget_is_sensitive(gtkWidget) != 0; 2228 } 2229 2230 /** 2231 * Determines whether the widget and all its parents are marked as 2232 * visible. 2233 * 2234 * This function does not check if the widget is obscured in any way. 2235 * 2236 * See also [method@Gtk.Widget.get_visible] and 2237 * [method@Gtk.Widget.set_visible]. 2238 * 2239 * Returns: %TRUE if the widget and all its parents are visible 2240 */ 2241 public bool isVisible() 2242 { 2243 return gtk_widget_is_visible(gtkWidget) != 0; 2244 } 2245 2246 /** 2247 * Emits the `::keynav-failed` signal on the widget. 2248 * 2249 * This function should be called whenever keyboard navigation 2250 * within a single widget hits a boundary. 2251 * 2252 * The return value of this function should be interpreted 2253 * in a way similar to the return value of 2254 * [method@Gtk.Widget.child_focus]. When %TRUE is returned, 2255 * stay in the widget, the failed keyboard navigation is OK 2256 * and/or there is nowhere we can/should move the focus to. 2257 * When %FALSE is returned, the caller should continue with 2258 * keyboard navigation outside the widget, e.g. by calling 2259 * [method@Gtk.Widget.child_focus] on the widget’s toplevel. 2260 * 2261 * The default [signal@Gtk.Widget::keynav-failed] handler returns 2262 * %FALSE for %GTK_DIR_TAB_FORWARD and %GTK_DIR_TAB_BACKWARD. 2263 * For the other values of `GtkDirectionType` it returns %TRUE. 2264 * 2265 * Whenever the default handler returns %TRUE, it also calls 2266 * [method@Gtk.Widget.error_bell] to notify the user of the 2267 * failed keyboard navigation. 2268 * 2269 * A use case for providing an own implementation of ::keynav-failed 2270 * (either by connecting to it or by overriding it) would be a row of 2271 * [class@Gtk.Entry] widgets where the user should be able to navigate 2272 * the entire row with the cursor keys, as e.g. known from user 2273 * interfaces that require entering license keys. 2274 * 2275 * Params: 2276 * direction = direction of focus movement 2277 * 2278 * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE 2279 * if the emitting widget should try to handle the keyboard 2280 * navigation attempt in its parent container(s). 2281 */ 2282 public bool keynavFailed(GtkDirectionType direction) 2283 { 2284 return gtk_widget_keynav_failed(gtkWidget, direction) != 0; 2285 } 2286 2287 /** 2288 * Returns the widgets for which this widget is the target of a 2289 * mnemonic. 2290 * 2291 * Typically, these widgets will be labels. See, for example, 2292 * [method@Gtk.Label.set_mnemonic_widget]. 2293 * 2294 * The widgets in the list are not individually referenced. 2295 * If you want to iterate through the list and perform actions 2296 * involving callbacks that might destroy the widgets, you 2297 * must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)` 2298 * first, and then unref all the widgets afterwards. 2299 * 2300 * Returns: the list 2301 * of mnemonic labels; free this list with g_list_free() when you 2302 * are done with it. 2303 */ 2304 public ListG listMnemonicLabels() 2305 { 2306 auto __p = gtk_widget_list_mnemonic_labels(gtkWidget); 2307 2308 if(__p is null) 2309 { 2310 return null; 2311 } 2312 2313 return new ListG(cast(GList*) __p); 2314 } 2315 2316 /** 2317 * Causes a widget to be mapped if it isn’t already. 2318 * 2319 * This function is only for use in widget implementations. 2320 */ 2321 public void map() 2322 { 2323 gtk_widget_map(gtkWidget); 2324 } 2325 2326 /** 2327 * Measures @widget in the orientation @orientation and for the given @for_size. 2328 * 2329 * As an example, if @orientation is %GTK_ORIENTATION_HORIZONTAL and @for_size 2330 * is 300, this functions will compute the minimum and natural width of @widget 2331 * if it is allocated at a height of 300 pixels. 2332 * 2333 * See [GtkWidget’s geometry management section](class.Widget.html#height-for-width-geometry-management) for 2334 * a more details on implementing `GtkWidgetClass.measure()`. 2335 * 2336 * Params: 2337 * orientation = the orientation to measure 2338 * forSize = Size for the opposite of @orientation, i.e. 2339 * if @orientation is %GTK_ORIENTATION_HORIZONTAL, this is 2340 * the height the widget should be measured with. The %GTK_ORIENTATION_VERTICAL 2341 * case is analogous. This way, both height-for-width and width-for-height 2342 * requests can be implemented. If no size is known, -1 can be passed. 2343 * minimum = location to store the minimum size 2344 * natural = location to store the natural size 2345 * minimumBaseline = location to store the baseline 2346 * position for the minimum size, or -1 to report no baseline 2347 * naturalBaseline = location to store the baseline 2348 * position for the natural size, or -1 to report no baseline 2349 */ 2350 public void measure(GtkOrientation orientation, int forSize, out int minimum, out int natural, out int minimumBaseline, out int naturalBaseline) 2351 { 2352 gtk_widget_measure(gtkWidget, orientation, forSize, &minimum, &natural, &minimumBaseline, &naturalBaseline); 2353 } 2354 2355 /** 2356 * Emits the ::mnemonic-activate signal. 2357 * 2358 * See [signal@Gtk.Widget::mnemonic-activate]. 2359 * 2360 * Params: 2361 * groupCycling = %TRUE if there are other widgets with the same mnemonic 2362 * 2363 * Returns: %TRUE if the signal has been handled 2364 */ 2365 public bool mnemonicActivate(bool groupCycling) 2366 { 2367 return gtk_widget_mnemonic_activate(gtkWidget, groupCycling) != 0; 2368 } 2369 2370 /** 2371 * Returns a `GListModel` to track the children of @widget. 2372 * 2373 * Calling this function will enable extra internal bookkeeping 2374 * to track children and emit signals on the returned listmodel. 2375 * It may slow down operations a lot. 2376 * 2377 * Applications should try hard to avoid calling this function 2378 * because of the slowdowns. 2379 * 2380 * Returns: a `GListModel` tracking @widget's children 2381 */ 2382 public ListModelIF observeChildren() 2383 { 2384 auto __p = gtk_widget_observe_children(gtkWidget); 2385 2386 if(__p is null) 2387 { 2388 return null; 2389 } 2390 2391 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p, true); 2392 } 2393 2394 /** 2395 * Returns a `GListModel` to track the [class@Gtk.EventController]s 2396 * of @widget. 2397 * 2398 * Calling this function will enable extra internal bookkeeping 2399 * to track controllers and emit signals on the returned listmodel. 2400 * It may slow down operations a lot. 2401 * 2402 * Applications should try hard to avoid calling this function 2403 * because of the slowdowns. 2404 * 2405 * Returns: a `GListModel` tracking @widget's controllers 2406 */ 2407 public ListModelIF observeControllers() 2408 { 2409 auto __p = gtk_widget_observe_controllers(gtkWidget); 2410 2411 if(__p is null) 2412 { 2413 return null; 2414 } 2415 2416 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p, true); 2417 } 2418 2419 /** 2420 * Finds the descendant of @widget closest to the point (@x, @y). 2421 * 2422 * The point must be given in widget coordinates, so (0, 0) is assumed 2423 * to be the top left of @widget's content area. 2424 * 2425 * Usually widgets will return %NULL if the given coordinate is not 2426 * contained in @widget checked via [method@Gtk.Widget.contains]. 2427 * Otherwise they will recursively try to find a child that does 2428 * not return %NULL. Widgets are however free to customize their 2429 * picking algorithm. 2430 * 2431 * This function is used on the toplevel to determine the widget 2432 * below the mouse cursor for purposes of hover highlighting and 2433 * delivering events. 2434 * 2435 * Params: 2436 * x = X coordinate to test, relative to @widget's origin 2437 * y = Y coordinate to test, relative to @widget's origin 2438 * flags = Flags to influence what is picked 2439 * 2440 * Returns: The widget descendant at 2441 * the given point 2442 */ 2443 public Widget pick(double x, double y, GtkPickFlags flags) 2444 { 2445 auto __p = gtk_widget_pick(gtkWidget, x, y, flags); 2446 2447 if(__p is null) 2448 { 2449 return null; 2450 } 2451 2452 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 2453 } 2454 2455 /** 2456 * Flags the widget for a rerun of the [vfunc@Gtk.Widget.size_allocate] 2457 * function. 2458 * 2459 * Use this function instead of [method@Gtk.Widget.queue_resize] 2460 * when the @widget's size request didn't change but it wants to 2461 * reposition its contents. 2462 * 2463 * An example user of this function is [method@Gtk.Widget.set_halign]. 2464 * 2465 * This function is only for use in widget implementations. 2466 */ 2467 public void queueAllocate() 2468 { 2469 gtk_widget_queue_allocate(gtkWidget); 2470 } 2471 2472 /** 2473 * Schedules this widget to be redrawn in the paint phase 2474 * of the current or the next frame. 2475 * 2476 * This means @widget's [vfunc@Gtk.Widget.snapshot] 2477 * implementation will be called. 2478 */ 2479 public void queueDraw() 2480 { 2481 gtk_widget_queue_draw(gtkWidget); 2482 } 2483 2484 /** 2485 * Flags a widget to have its size renegotiated. 2486 * 2487 * This should be called when a widget for some reason has a new 2488 * size request. For example, when you change the text in a 2489 * [class@Gtk.Label], the label queues a resize to ensure there’s 2490 * enough space for the new text. 2491 * 2492 * Note that you cannot call gtk_widget_queue_resize() on a widget 2493 * from inside its implementation of the [vfunc@Gtk.Widget.size_allocate] 2494 * virtual method. Calls to gtk_widget_queue_resize() from inside 2495 * [vfunc@Gtk.Widget.size_allocate] will be silently ignored. 2496 * 2497 * This function is only for use in widget implementations. 2498 */ 2499 public void queueResize() 2500 { 2501 gtk_widget_queue_resize(gtkWidget); 2502 } 2503 2504 /** 2505 * Creates the GDK resources associated with a widget. 2506 * 2507 * Normally realization happens implicitly; if you show a widget 2508 * and all its parent containers, then the widget will be realized 2509 * and mapped automatically. 2510 * 2511 * Realizing a widget requires all the widget’s parent widgets to be 2512 * realized; calling this function realizes the widget’s parents 2513 * in addition to @widget itself. If a widget is not yet inside a 2514 * toplevel window when you realize it, bad things will happen. 2515 * 2516 * This function is primarily used in widget implementations, and 2517 * isn’t very useful otherwise. Many times when you think you might 2518 * need it, a better approach is to connect to a signal that will be 2519 * called after the widget is realized automatically, such as 2520 * [signal@Gtk.Widget::realize]. 2521 */ 2522 public void realize() 2523 { 2524 gtk_widget_realize(gtkWidget); 2525 } 2526 2527 /** 2528 * Removes @controller from @widget, so that it doesn't process 2529 * events anymore. 2530 * 2531 * It should not be used again. 2532 * 2533 * Widgets will remove all event controllers automatically when they 2534 * are destroyed, there is normally no need to call this function. 2535 * 2536 * Params: 2537 * controller = a `GtkEventController` 2538 */ 2539 public void removeController(EventController controller) 2540 { 2541 gtk_widget_remove_controller(gtkWidget, (controller is null) ? null : controller.getEventControllerStruct()); 2542 } 2543 2544 /** 2545 * Removes a style from @widget. 2546 * 2547 * After this, the style of @widget will stop matching for @css_class. 2548 * 2549 * Params: 2550 * cssClass = The style class to remove from @widget, without 2551 * the leading '.' used for notation of style classes 2552 */ 2553 public void removeCssClass(string cssClass) 2554 { 2555 gtk_widget_remove_css_class(gtkWidget, Str.toStringz(cssClass)); 2556 } 2557 2558 /** 2559 * Removes a widget from the list of mnemonic labels for this widget. 2560 * 2561 * See [method@Gtk.Widget.list_mnemonic_labels]. The widget must 2562 * have previously been added to the list with 2563 * [method@Gtk.Widget.add_mnemonic_label]. 2564 * 2565 * Params: 2566 * label = a `GtkWidget` that was previously set as a mnemonic 2567 * label for @widget with [method@Gtk.Widget.add_mnemonic_label] 2568 */ 2569 public void removeMnemonicLabel(Widget label) 2570 { 2571 gtk_widget_remove_mnemonic_label(gtkWidget, (label is null) ? null : label.getWidgetStruct()); 2572 } 2573 2574 /** 2575 * Removes a tick callback previously registered with 2576 * gtk_widget_add_tick_callback(). 2577 * 2578 * Params: 2579 * id = an id returned by [method@Gtk.Widget.add_tick_callback] 2580 */ 2581 public void removeTickCallback(uint id) 2582 { 2583 gtk_widget_remove_tick_callback(gtkWidget, id); 2584 } 2585 2586 /** 2587 * Specifies whether the input focus can enter the widget 2588 * or any of its children. 2589 * 2590 * Applications should set @can_focus to %FALSE to mark a 2591 * widget as for pointer/touch use only. 2592 * 2593 * Note that having @can_focus be %TRUE is only one of the 2594 * necessary conditions for being focusable. A widget must 2595 * also be sensitive and focusable and not have an ancestor 2596 * that is marked as not can-focus in order to receive input 2597 * focus. 2598 * 2599 * See [method@Gtk.Widget.grab_focus] for actually setting 2600 * the input focus on a widget. 2601 * 2602 * Params: 2603 * canFocus = whether or not the input focus can enter 2604 * the widget or any of its children 2605 */ 2606 public void setCanFocus(bool canFocus) 2607 { 2608 gtk_widget_set_can_focus(gtkWidget, canFocus); 2609 } 2610 2611 /** 2612 * Sets whether @widget can be the target of pointer events. 2613 * 2614 * Params: 2615 * canTarget = whether this widget should be able to 2616 * receive pointer events 2617 */ 2618 public void setCanTarget(bool canTarget) 2619 { 2620 gtk_widget_set_can_target(gtkWidget, canTarget); 2621 } 2622 2623 /** 2624 * Sets whether @widget should be mapped along with its parent. 2625 * 2626 * The child visibility can be set for widget before it is added 2627 * to a container with [method@Gtk.Widget.set_parent], to avoid 2628 * mapping children unnecessary before immediately unmapping them. 2629 * However it will be reset to its default state of %TRUE when the 2630 * widget is removed from a container. 2631 * 2632 * Note that changing the child visibility of a widget does not 2633 * queue a resize on the widget. Most of the time, the size of 2634 * a widget is computed from all visible children, whether or 2635 * not they are mapped. If this is not the case, the container 2636 * can queue a resize itself. 2637 * 2638 * This function is only useful for container implementations 2639 * and should never be called by an application. 2640 * 2641 * Params: 2642 * childVisible = if %TRUE, @widget should be mapped along 2643 * with its parent. 2644 */ 2645 public void setChildVisible(bool childVisible) 2646 { 2647 gtk_widget_set_child_visible(gtkWidget, childVisible); 2648 } 2649 2650 /** 2651 * Clear all style classes applied to @widget 2652 * and replace them with @classes. 2653 * 2654 * Params: 2655 * classes = %NULL-terminated list of style classes to apply to @widget. 2656 */ 2657 public void setCssClasses(string[] classes) 2658 { 2659 gtk_widget_set_css_classes(gtkWidget, Str.toStringzArray(classes)); 2660 } 2661 2662 /** 2663 * Sets the cursor to be shown when pointer devices point 2664 * towards @widget. 2665 * 2666 * If the @cursor is NULL, @widget will use the cursor 2667 * inherited from the parent widget. 2668 * 2669 * Params: 2670 * cursor = the new cursor 2671 */ 2672 public void setCursor(Cursor cursor) 2673 { 2674 gtk_widget_set_cursor(gtkWidget, (cursor is null) ? null : cursor.getCursorStruct()); 2675 } 2676 2677 /** 2678 * Sets a named cursor to be shown when pointer devices point 2679 * towards @widget. 2680 * 2681 * This is a utility function that creates a cursor via 2682 * [ctor@Gdk.Cursor.new_from_name] and then sets it on @widget 2683 * with [method@Gtk.Widget.set_cursor]. See those functions for 2684 * details. 2685 * 2686 * On top of that, this function allows @name to be %NULL, which 2687 * will do the same as calling [method@Gtk.Widget.set_cursor] 2688 * with a %NULL cursor. 2689 * 2690 * Params: 2691 * name = The name of the cursor 2692 */ 2693 public void setCursorFromName(string name) 2694 { 2695 gtk_widget_set_cursor_from_name(gtkWidget, Str.toStringz(name)); 2696 } 2697 2698 /** 2699 * Sets the reading direction on a particular widget. 2700 * 2701 * This direction controls the primary direction for widgets 2702 * containing text, and also the direction in which the children 2703 * of a container are packed. The ability to set the direction is 2704 * present in order so that correct localization into languages with 2705 * right-to-left reading directions can be done. Generally, applications 2706 * will let the default reading direction present, except for containers 2707 * where the containers are arranged in an order that is explicitly 2708 * visual rather than logical (such as buttons for text justification). 2709 * 2710 * If the direction is set to %GTK_TEXT_DIR_NONE, then the value 2711 * set by [func@Gtk.Widget.set_default_direction] will be used. 2712 * 2713 * Params: 2714 * dir = the new direction 2715 */ 2716 public void setDirection(GtkTextDirection dir) 2717 { 2718 gtk_widget_set_direction(gtkWidget, dir); 2719 } 2720 2721 /** 2722 * Set @child as the current focus child of @widget. 2723 * 2724 * This function is only suitable for widget implementations. 2725 * If you want a certain widget to get the input focus, call 2726 * [method@Gtk.Widget.grab_focus] on it. 2727 * 2728 * Params: 2729 * child = a direct child widget of @widget or %NULL 2730 * to unset the focus child of @widget 2731 */ 2732 public void setFocusChild(Widget child) 2733 { 2734 gtk_widget_set_focus_child(gtkWidget, (child is null) ? null : child.getWidgetStruct()); 2735 } 2736 2737 /** 2738 * Sets whether the widget should grab focus when it is clicked 2739 * with the mouse. 2740 * 2741 * Making mouse clicks not grab focus is useful in places like 2742 * toolbars where you don’t want the keyboard focus removed from 2743 * the main area of the application. 2744 * 2745 * Params: 2746 * focusOnClick = whether the widget should grab focus when clicked 2747 * with the mouse 2748 */ 2749 public void setFocusOnClick(bool focusOnClick) 2750 { 2751 gtk_widget_set_focus_on_click(gtkWidget, focusOnClick); 2752 } 2753 2754 /** 2755 * Specifies whether @widget can own the input focus. 2756 * 2757 * Widget implementations should set @focusable to %TRUE in 2758 * their init() function if they want to receive keyboard input. 2759 * 2760 * Note that having @focusable be %TRUE is only one of the 2761 * necessary conditions for being focusable. A widget must 2762 * also be sensitive and can-focus and not have an ancestor 2763 * that is marked as not can-focus in order to receive input 2764 * focus. 2765 * 2766 * See [method@Gtk.Widget.grab_focus] for actually setting 2767 * the input focus on a widget. 2768 * 2769 * Params: 2770 * focusable = whether or not @widget can own the input focus 2771 */ 2772 public void setFocusable(bool focusable) 2773 { 2774 gtk_widget_set_focusable(gtkWidget, focusable); 2775 } 2776 2777 /** 2778 * Sets the font map to use for Pango rendering. 2779 * 2780 * The font map is the object that is used to look up fonts. 2781 * Setting a custom font map can be useful in special situations, 2782 * e.g. when you need to add application-specific fonts to the set 2783 * of available fonts. 2784 * 2785 * When not set, the widget will inherit the font map from its parent. 2786 * 2787 * Params: 2788 * fontMap = a `PangoFontMap`, or %NULL to unset any 2789 * previously set font map 2790 */ 2791 public void setFontMap(PgFontMap fontMap) 2792 { 2793 gtk_widget_set_font_map(gtkWidget, (fontMap is null) ? null : fontMap.getPgFontMapStruct()); 2794 } 2795 2796 /** 2797 * Sets the `cairo_font_options_t` used for Pango rendering 2798 * in this widget. 2799 * 2800 * When not set, the default font options for the `GdkDisplay` 2801 * will be used. 2802 * 2803 * Params: 2804 * options = a `cairo_font_options_t` 2805 * to unset any previously set default font options 2806 */ 2807 public void setFontOptions(FontOption options) 2808 { 2809 gtk_widget_set_font_options(gtkWidget, (options is null) ? null : options.getFontOptionStruct()); 2810 } 2811 2812 /** 2813 * Sets the horizontal alignment of @widget. 2814 * 2815 * Params: 2816 * align_ = the horizontal alignment 2817 */ 2818 public void setHalign(GtkAlign align_) 2819 { 2820 gtk_widget_set_halign(gtkWidget, align_); 2821 } 2822 2823 /** 2824 * Sets the `has-tooltip` property on @widget to @has_tooltip. 2825 * 2826 * Params: 2827 * hasTooltip = whether or not @widget has a tooltip. 2828 */ 2829 public void setHasTooltip(bool hasTooltip) 2830 { 2831 gtk_widget_set_has_tooltip(gtkWidget, hasTooltip); 2832 } 2833 2834 /** 2835 * Sets whether the widget would like any available extra horizontal 2836 * space. 2837 * 2838 * When a user resizes a `GtkWindow`, widgets with expand=TRUE 2839 * generally receive the extra space. For example, a list or 2840 * scrollable area or document in your window would often be set to 2841 * expand. 2842 * 2843 * Call this function to set the expand flag if you would like your 2844 * widget to become larger horizontally when the window has extra 2845 * room. 2846 * 2847 * By default, widgets automatically expand if any of their children 2848 * want to expand. (To see if a widget will automatically expand given 2849 * its current children and state, call [method@Gtk.Widget.compute_expand]. 2850 * A container can decide how the expandability of children affects the 2851 * expansion of the container by overriding the compute_expand virtual 2852 * method on `GtkWidget`.). 2853 * 2854 * Setting hexpand explicitly with this function will override the 2855 * automatic expand behavior. 2856 * 2857 * This function forces the widget to expand or not to expand, 2858 * regardless of children. The override occurs because 2859 * [method@Gtk.Widget.set_hexpand] sets the hexpand-set property (see 2860 * [method@Gtk.Widget.set_hexpand_set]) which causes the widget’s hexpand 2861 * value to be used, rather than looking at children and widget state. 2862 * 2863 * Params: 2864 * expand = whether to expand 2865 */ 2866 public void setHexpand(bool expand) 2867 { 2868 gtk_widget_set_hexpand(gtkWidget, expand); 2869 } 2870 2871 /** 2872 * Sets whether the hexpand flag will be used. 2873 * 2874 * The [property@Gtk.Widget:hexpand-set] property will be set 2875 * automatically when you call [method@Gtk.Widget.set_hexpand] 2876 * to set hexpand, so the most likely reason to use this function 2877 * would be to unset an explicit expand flag. 2878 * 2879 * If hexpand is set, then it overrides any computed 2880 * expand value based on child widgets. If hexpand is not 2881 * set, then the expand value depends on whether any 2882 * children of the widget would like to expand. 2883 * 2884 * There are few reasons to use this function, but it’s here 2885 * for completeness and consistency. 2886 * 2887 * Params: 2888 * set = value for hexpand-set property 2889 */ 2890 public void setHexpandSet(bool set) 2891 { 2892 gtk_widget_set_hexpand_set(gtkWidget, set); 2893 } 2894 2895 /** 2896 * Sets the layout manager delegate instance that provides an 2897 * implementation for measuring and allocating the children of @widget. 2898 * 2899 * Params: 2900 * layoutManager = a `GtkLayoutManager` 2901 */ 2902 public void setLayoutManager(LayoutManager layoutManager) 2903 { 2904 gtk_widget_set_layout_manager(gtkWidget, (layoutManager is null) ? null : layoutManager.getLayoutManagerStruct()); 2905 } 2906 2907 /** 2908 * Sets the bottom margin of @widget. 2909 * 2910 * Params: 2911 * margin = the bottom margin 2912 */ 2913 public void setMarginBottom(int margin) 2914 { 2915 gtk_widget_set_margin_bottom(gtkWidget, margin); 2916 } 2917 2918 /** 2919 * Sets the end margin of @widget. 2920 * 2921 * Params: 2922 * margin = the end margin 2923 */ 2924 public void setMarginEnd(int margin) 2925 { 2926 gtk_widget_set_margin_end(gtkWidget, margin); 2927 } 2928 2929 /** 2930 * Sets the start margin of @widget. 2931 * 2932 * Params: 2933 * margin = the start margin 2934 */ 2935 public void setMarginStart(int margin) 2936 { 2937 gtk_widget_set_margin_start(gtkWidget, margin); 2938 } 2939 2940 /** 2941 * Sets the top margin of @widget. 2942 * 2943 * Params: 2944 * margin = the top margin 2945 */ 2946 public void setMarginTop(int margin) 2947 { 2948 gtk_widget_set_margin_top(gtkWidget, margin); 2949 } 2950 2951 /** 2952 * Sets a widgets name. 2953 * 2954 * Setting a name allows you to refer to the widget from a 2955 * CSS file. You can apply a style to widgets with a particular name 2956 * in the CSS file. See the documentation for the CSS syntax (on the 2957 * same page as the docs for [class@Gtk.StyleContext]. 2958 * 2959 * Note that the CSS syntax has certain special characters to delimit 2960 * and represent elements in a selector (period, #, >, *...), so using 2961 * these will make your widget impossible to match by name. Any combination 2962 * of alphanumeric symbols, dashes and underscores will suffice. 2963 * 2964 * Params: 2965 * name = name for the widget 2966 */ 2967 public void setName(string name) 2968 { 2969 gtk_widget_set_name(gtkWidget, Str.toStringz(name)); 2970 } 2971 2972 /** 2973 * Request the @widget to be rendered partially transparent. 2974 * 2975 * An opacity of 0 is fully transparent and an opacity of 1 2976 * is fully opaque. 2977 * 2978 * Opacity works on both toplevel widgets and child widgets, although 2979 * there are some limitations: For toplevel widgets, applying opacity 2980 * depends on the capabilities of the windowing system. On X11, this 2981 * has any effect only on X displays with a compositing manager, 2982 * see gdk_display_is_composited(). On Windows and Wayland it should 2983 * always work, although setting a window’s opacity after the window 2984 * has been shown may cause some flicker. 2985 * 2986 * Note that the opacity is inherited through inclusion — if you set 2987 * a toplevel to be partially translucent, all of its content will 2988 * appear translucent, since it is ultimatively rendered on that 2989 * toplevel. The opacity value itself is not inherited by child 2990 * widgets (since that would make widgets deeper in the hierarchy 2991 * progressively more translucent). As a consequence, [class@Gtk.Popover]s 2992 * and other [iface@Gtk.Native] widgets with their own surface will use their 2993 * own opacity value, and thus by default appear non-translucent, 2994 * even if they are attached to a toplevel that is translucent. 2995 * 2996 * Params: 2997 * opacity = desired opacity, between 0 and 1 2998 */ 2999 public void setOpacity(double opacity) 3000 { 3001 gtk_widget_set_opacity(gtkWidget, opacity); 3002 } 3003 3004 /** 3005 * Sets how @widget treats content that is drawn outside the 3006 * widget's content area. 3007 * 3008 * See the definition of [enum@Gtk.Overflow] for details. 3009 * 3010 * This setting is provided for widget implementations and 3011 * should not be used by application code. 3012 * 3013 * The default value is %GTK_OVERFLOW_VISIBLE. 3014 * 3015 * Params: 3016 * overflow = desired overflow 3017 */ 3018 public void setOverflow(GtkOverflow overflow) 3019 { 3020 gtk_widget_set_overflow(gtkWidget, overflow); 3021 } 3022 3023 /** 3024 * Sets @parent as the parent widget of @widget. 3025 * 3026 * This takes care of details such as updating the state and style 3027 * of the child to reflect its new location and resizing the parent. 3028 * The opposite function is [method@Gtk.Widget.unparent]. 3029 * 3030 * This function is useful only when implementing subclasses of 3031 * `GtkWidget`. 3032 * 3033 * Params: 3034 * parent = parent widget 3035 */ 3036 public void setParent(Widget parent) 3037 { 3038 gtk_widget_set_parent(gtkWidget, (parent is null) ? null : parent.getWidgetStruct()); 3039 } 3040 3041 /** 3042 * Specifies whether @widget will be treated as the default 3043 * widget within its toplevel when it has the focus, even if 3044 * another widget is the default. 3045 * 3046 * Params: 3047 * receivesDefault = whether or not @widget can be a default widget. 3048 */ 3049 public void setReceivesDefault(bool receivesDefault) 3050 { 3051 gtk_widget_set_receives_default(gtkWidget, receivesDefault); 3052 } 3053 3054 /** 3055 * Sets the sensitivity of a widget. 3056 * 3057 * A widget is sensitive if the user can interact with it. 3058 * Insensitive widgets are “grayed out” and the user can’t 3059 * interact with them. Insensitive widgets are known as 3060 * “inactive”, “disabled”, or “ghosted” in some other toolkits. 3061 * 3062 * Params: 3063 * sensitive = %TRUE to make the widget sensitive 3064 */ 3065 public void setSensitive(bool sensitive) 3066 { 3067 gtk_widget_set_sensitive(gtkWidget, sensitive); 3068 } 3069 3070 /** 3071 * Sets the minimum size of a widget. 3072 * 3073 * That is, the widget’s size request will be at least @width 3074 * by @height. You can use this function to force a widget to 3075 * be larger than it normally would be. 3076 * 3077 * In most cases, [method@Gtk.Window.set_default_size] is a better 3078 * choice for toplevel windows than this function; setting the default 3079 * size will still allow users to shrink the window. Setting the size 3080 * request will force them to leave the window at least as large as 3081 * the size request. 3082 * 3083 * Note the inherent danger of setting any fixed size - themes, 3084 * translations into other languages, different fonts, and user action 3085 * can all change the appropriate size for a given widget. So, it's 3086 * basically impossible to hardcode a size that will always be 3087 * correct. 3088 * 3089 * The size request of a widget is the smallest size a widget can 3090 * accept while still functioning well and drawing itself correctly. 3091 * However in some strange cases a widget may be allocated less than 3092 * its requested size, and in many cases a widget may be allocated more 3093 * space than it requested. 3094 * 3095 * If the size request in a given direction is -1 (unset), then 3096 * the “natural” size request of the widget will be used instead. 3097 * 3098 * The size request set here does not include any margin from the 3099 * properties 3100 * [property@Gtk.Widget:margin-start], 3101 * [property@Gtk.Widget:margin-end], 3102 * [property@Gtk.Widget:margin-top], and 3103 * [property@Gtk.Widget:margin-bottom], but it does include pretty 3104 * much all other padding or border properties set by any subclass 3105 * of `GtkWidget`. 3106 * 3107 * Params: 3108 * width = width @widget should request, or -1 to unset 3109 * height = height @widget should request, or -1 to unset 3110 */ 3111 public void setSizeRequest(int width, int height) 3112 { 3113 gtk_widget_set_size_request(gtkWidget, width, height); 3114 } 3115 3116 /** 3117 * Turns on flag values in the current widget state. 3118 * 3119 * Typical widget states are insensitive, prelighted, etc. 3120 * 3121 * This function accepts the values %GTK_STATE_FLAG_DIR_LTR and 3122 * %GTK_STATE_FLAG_DIR_RTL but ignores them. If you want to set 3123 * the widget's direction, use [method@Gtk.Widget.set_direction]. 3124 * 3125 * This function is for use in widget implementations. 3126 * 3127 * Params: 3128 * flags = State flags to turn on 3129 * clear = Whether to clear state before turning on @flags 3130 */ 3131 public void setStateFlags(GtkStateFlags flags, bool clear) 3132 { 3133 gtk_widget_set_state_flags(gtkWidget, flags, clear); 3134 } 3135 3136 /** 3137 * Sets @markup as the contents of the tooltip, which is marked 3138 * up with Pango markup. 3139 * 3140 * This function will take care of setting the 3141 * [property@Gtk.Widget:has-tooltip] as a side effect, and of the 3142 * default handler for the [signal@Gtk.Widget::query-tooltip] signal. 3143 * 3144 * See also [method@Gtk.Tooltip.set_markup]. 3145 * 3146 * Params: 3147 * markup = the contents of the tooltip for @widget 3148 */ 3149 public void setTooltipMarkup(string markup) 3150 { 3151 gtk_widget_set_tooltip_markup(gtkWidget, Str.toStringz(markup)); 3152 } 3153 3154 /** 3155 * Sets @text as the contents of the tooltip. 3156 * 3157 * If @text contains any markup, it will be escaped. 3158 * 3159 * This function will take care of setting 3160 * [property@Gtk.Widget:has-tooltip] as a side effect, 3161 * and of the default handler for the 3162 * [signal@Gtk.Widget::query-tooltip] signal. 3163 * 3164 * See also [method@Gtk.Tooltip.set_text]. 3165 * 3166 * Params: 3167 * text = the contents of the tooltip for @widget 3168 */ 3169 public void setTooltipText(string text) 3170 { 3171 gtk_widget_set_tooltip_text(gtkWidget, Str.toStringz(text)); 3172 } 3173 3174 /** 3175 * Sets the vertical alignment of @widget. 3176 * 3177 * Params: 3178 * align_ = the vertical alignment 3179 */ 3180 public void setValign(GtkAlign align_) 3181 { 3182 gtk_widget_set_valign(gtkWidget, align_); 3183 } 3184 3185 /** 3186 * Sets whether the widget would like any available extra vertical 3187 * space. 3188 * 3189 * See [method@Gtk.Widget.set_hexpand] for more detail. 3190 * 3191 * Params: 3192 * expand = whether to expand 3193 */ 3194 public void setVexpand(bool expand) 3195 { 3196 gtk_widget_set_vexpand(gtkWidget, expand); 3197 } 3198 3199 /** 3200 * Sets whether the vexpand flag will be used. 3201 * 3202 * See [method@Gtk.Widget.set_hexpand_set] for more detail. 3203 * 3204 * Params: 3205 * set = value for vexpand-set property 3206 */ 3207 public void setVexpandSet(bool set) 3208 { 3209 gtk_widget_set_vexpand_set(gtkWidget, set); 3210 } 3211 3212 /** 3213 * Sets the visibility state of @widget. 3214 * 3215 * Note that setting this to %TRUE doesn’t mean the widget is 3216 * actually viewable, see [method@Gtk.Widget.get_visible]. 3217 * 3218 * This function simply calls [method@Gtk.Widget.show] or 3219 * [method@Gtk.Widget.hide] but is nicer to use when the 3220 * visibility of the widget depends on some condition. 3221 * 3222 * Params: 3223 * visible = whether the widget should be shown or not 3224 */ 3225 public void setVisible(bool visible) 3226 { 3227 gtk_widget_set_visible(gtkWidget, visible); 3228 } 3229 3230 /** 3231 * Returns whether @widget should contribute to 3232 * the measuring and allocation of its parent. 3233 * 3234 * This is %FALSE for invisible children, but also 3235 * for children that have their own surface. 3236 * 3237 * Returns: %TRUE if child should be included in 3238 * measuring and allocating 3239 */ 3240 public bool shouldLayout() 3241 { 3242 return gtk_widget_should_layout(gtkWidget) != 0; 3243 } 3244 3245 /** 3246 * Flags a widget to be displayed. 3247 * 3248 * Any widget that isn’t shown will not appear on the screen. 3249 * 3250 * Remember that you have to show the containers containing a widget, 3251 * in addition to the widget itself, before it will appear onscreen. 3252 * 3253 * When a toplevel container is shown, it is immediately realized and 3254 * mapped; other shown widgets are realized and mapped when their 3255 * toplevel container is realized and mapped. 3256 */ 3257 public void show() 3258 { 3259 gtk_widget_show(gtkWidget); 3260 } 3261 3262 /** 3263 * Allocates widget with a transformation that translates 3264 * the origin to the position in @allocation. 3265 * 3266 * This is a simple form of [method@Gtk.Widget.allocate]. 3267 * 3268 * Params: 3269 * allocation = position and size to be allocated to @widget 3270 * baseline = The baseline of the child, or -1 3271 */ 3272 public void sizeAllocate(GtkAllocation* allocation, int baseline) 3273 { 3274 gtk_widget_size_allocate(gtkWidget, allocation, baseline); 3275 } 3276 3277 /** 3278 * Snapshot the a child of @widget. 3279 * 3280 * When a widget receives a call to the snapshot function, 3281 * it must send synthetic [vfunc@Gtk.Widget.snapshot] calls 3282 * to all children. This function provides a convenient way 3283 * of doing this. A widget, when it receives a call to its 3284 * [vfunc@Gtk.Widget.snapshot] function, calls 3285 * gtk_widget_snapshot_child() once for each child, passing in 3286 * the @snapshot the widget received. 3287 * 3288 * gtk_widget_snapshot_child() takes care of translating the origin of 3289 * @snapshot, and deciding whether the child needs to be snapshot. 3290 * 3291 * This function does nothing for children that implement `GtkNative`. 3292 * 3293 * Params: 3294 * child = a child of @widget 3295 * snapshot = `GtkSnapshot` as passed to the widget. In particular, no 3296 * calls to gtk_snapshot_translate() or other transform calls should 3297 * have been made. 3298 */ 3299 public void snapshotChild(Widget child, Snapshot snapshot) 3300 { 3301 gtk_widget_snapshot_child(gtkWidget, (child is null) ? null : child.getWidgetStruct(), (snapshot is null) ? null : snapshot.getGtkSnapshotStruct()); 3302 } 3303 3304 /** 3305 * Translate coordinates relative to @src_widget’s allocation 3306 * to coordinates relative to @dest_widget’s allocations. 3307 * 3308 * In order to perform this operation, both widget must share 3309 * a common ancestor. 3310 * 3311 * Params: 3312 * destWidget = a `GtkWidget` 3313 * srcX = X position relative to @src_widget 3314 * srcY = Y position relative to @src_widget 3315 * destX = location to store X position relative to @dest_widget 3316 * destY = location to store Y position relative to @dest_widget 3317 * 3318 * Returns: %FALSE if @src_widget and @dest_widget have no common 3319 * ancestor. In this case, 0 is stored in *@dest_x and *@dest_y. 3320 * Otherwise %TRUE. 3321 */ 3322 public bool translateCoordinates(Widget destWidget, double srcX, double srcY, out double destX, out double destY) 3323 { 3324 return gtk_widget_translate_coordinates(gtkWidget, (destWidget is null) ? null : destWidget.getWidgetStruct(), srcX, srcY, &destX, &destY) != 0; 3325 } 3326 3327 /** 3328 * Triggers a tooltip query on the display where the toplevel 3329 * of @widget is located. 3330 */ 3331 public void triggerTooltipQuery() 3332 { 3333 gtk_widget_trigger_tooltip_query(gtkWidget); 3334 } 3335 3336 /** 3337 * Causes a widget to be unmapped if it’s currently mapped. 3338 * 3339 * This function is only for use in widget implementations. 3340 */ 3341 public void unmap() 3342 { 3343 gtk_widget_unmap(gtkWidget); 3344 } 3345 3346 /** 3347 * Dissociate @widget from its parent. 3348 * 3349 * This function is only for use in widget implementations, 3350 * typically in dispose. 3351 */ 3352 public void unparent() 3353 { 3354 gtk_widget_unparent(gtkWidget); 3355 } 3356 3357 /** 3358 * Causes a widget to be unrealized (frees all GDK resources 3359 * associated with the widget). 3360 * 3361 * This function is only useful in widget implementations. 3362 */ 3363 public void unrealize() 3364 { 3365 gtk_widget_unrealize(gtkWidget); 3366 } 3367 3368 /** 3369 * Turns off flag values for the current widget state. 3370 * 3371 * See [method@Gtk.Widget.set_state_flags]. 3372 * 3373 * This function is for use in widget implementations. 3374 * 3375 * Params: 3376 * flags = State flags to turn off 3377 */ 3378 public void unsetStateFlags(GtkStateFlags flags) 3379 { 3380 gtk_widget_unset_state_flags(gtkWidget, flags); 3381 } 3382 3383 /** 3384 * Signals that all holders of a reference to the widget should release 3385 * the reference that they hold. 3386 * 3387 * May result in finalization of the widget if all references are released. 3388 * 3389 * This signal is not suitable for saving widget state. 3390 */ 3391 gulong addOnDestroy(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3392 { 3393 return Signals.connect(this, "destroy", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3394 } 3395 3396 /** 3397 * Emitted when the text direction of a widget changes. 3398 * 3399 * Params: 3400 * previousDirection = the previous text direction of @widget 3401 */ 3402 gulong addOnDirectionChanged(void delegate(GtkTextDirection, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3403 { 3404 return Signals.connect(this, "direction-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3405 } 3406 3407 /** 3408 * Emitted when @widget is hidden. 3409 */ 3410 gulong addOnHide(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3411 { 3412 return Signals.connect(this, "hide", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3413 } 3414 3415 /** 3416 * Emitted if keyboard navigation fails. 3417 * 3418 * See [method@Gtk.Widget.keynav_failed] for details. 3419 * 3420 * Params: 3421 * direction = the direction of movement 3422 * 3423 * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE 3424 * if the emitting widget should try to handle the keyboard 3425 * navigation attempt in its parent widget(s). 3426 */ 3427 gulong addOnKeynavFailed(bool delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3428 { 3429 return Signals.connect(this, "keynav-failed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3430 } 3431 3432 /** 3433 * Emitted when @widget is going to be mapped. 3434 * 3435 * A widget is mapped when the widget is visible (which is controlled with 3436 * [property@Gtk.Widget:visible]) and all its parents up to the toplevel widget 3437 * are also visible. 3438 * 3439 * The ::map signal can be used to determine whether a widget will be drawn, 3440 * for instance it can resume an animation that was stopped during the 3441 * emission of [signal@Gtk.Widget::unmap]. 3442 */ 3443 gulong addOnMap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3444 { 3445 return Signals.connect(this, "map", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3446 } 3447 3448 /** 3449 * Emitted when a widget is activated via a mnemonic. 3450 * 3451 * The default handler for this signal activates @widget if @group_cycling 3452 * is %FALSE, or just makes @widget grab focus if @group_cycling is %TRUE. 3453 * 3454 * Params: 3455 * groupCycling = %TRUE if there are other widgets with the same mnemonic 3456 * 3457 * Returns: %TRUE to stop other handlers from being invoked for the event. 3458 * %FALSE to propagate the event further. 3459 */ 3460 gulong addOnMnemonicActivate(bool delegate(bool, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3461 { 3462 return Signals.connect(this, "mnemonic-activate", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3463 } 3464 3465 /** 3466 * Emitted when the focus is moved. 3467 * 3468 * Params: 3469 * direction = the direction of the focus move 3470 */ 3471 gulong addOnMoveFocus(void delegate(GtkDirectionType, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3472 { 3473 return Signals.connect(this, "move-focus", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3474 } 3475 3476 /** 3477 * Emitted when the widgets tooltip is about to be shown. 3478 * 3479 * This happens when the [property@Gtk.Widget:has-tooltip] property 3480 * is %TRUE and the hover timeout has expired with the cursor hovering 3481 * "above" @widget; or emitted when @widget got focus in keyboard mode. 3482 * 3483 * Using the given coordinates, the signal handler should determine 3484 * whether a tooltip should be shown for @widget. If this is the case 3485 * %TRUE should be returned, %FALSE otherwise. Note that if 3486 * @keyboard_mode is %TRUE, the values of @x and @y are undefined and 3487 * should not be used. 3488 * 3489 * The signal handler is free to manipulate @tooltip with the therefore 3490 * destined function calls. 3491 * 3492 * Params: 3493 * x = the x coordinate of the cursor position where the request has 3494 * been emitted, relative to @widget's left side 3495 * y = the y coordinate of the cursor position where the request has 3496 * been emitted, relative to @widget's top 3497 * keyboardMode = %TRUE if the tooltip was triggered using the keyboard 3498 * tooltip = a `GtkTooltip` 3499 * 3500 * Returns: %TRUE if @tooltip should be shown right now, %FALSE otherwise. 3501 */ 3502 gulong addOnQueryTooltip(bool delegate(int, int, bool, Tooltip, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3503 { 3504 return Signals.connect(this, "query-tooltip", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3505 } 3506 3507 /** 3508 * Emitted when @widget is associated with a `GdkSurface`. 3509 * 3510 * This means that [method@Gtk.Widget.realize] has been called 3511 * or the widget has been mapped (that is, it is going to be drawn). 3512 */ 3513 gulong addOnRealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3514 { 3515 return Signals.connect(this, "realize", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3516 } 3517 3518 /** 3519 * Emitted when @widget is shown. 3520 */ 3521 gulong addOnShow(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3522 { 3523 return Signals.connect(this, "show", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3524 } 3525 3526 /** 3527 * Emitted when the widget state changes. 3528 * 3529 * See [method@Gtk.Widget.get_state_flags]. 3530 * 3531 * Params: 3532 * flags = The previous state flags. 3533 */ 3534 gulong addOnStateFlagsChanged(void delegate(GtkStateFlags, Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3535 { 3536 return Signals.connect(this, "state-flags-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3537 } 3538 3539 /** 3540 * Emitted when @widget is going to be unmapped. 3541 * 3542 * A widget is unmapped when either it or any of its parents up to the 3543 * toplevel widget have been set as hidden. 3544 * 3545 * As ::unmap indicates that a widget will not be shown any longer, 3546 * it can be used to, for example, stop an animation on the widget. 3547 */ 3548 gulong addOnUnmap(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3549 { 3550 return Signals.connect(this, "unmap", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3551 } 3552 3553 /** 3554 * Emitted when the `GdkSurface` associated with @widget is destroyed. 3555 * 3556 * This means that [method@Gtk.Widget.unrealize] has been called 3557 * or the widget has been unmapped (that is, it is going to be hidden). 3558 */ 3559 gulong addOnUnrealize(void delegate(Widget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 3560 { 3561 return Signals.connect(this, "unrealize", dlg, connectFlags ^ ConnectFlags.SWAPPED); 3562 } 3563 }